<template>
  <!--下方查看详情表格面板-->
  <el-collapse-transition>
    <div v-if="showTable" class="new-queryResultDiv" :class="showSelectId ? 'min-Table' : 'max-Table'">
      <div class="new-queryTableBtn">
        <el-button @click="closeTableDiv" type="primary">关闭</el-button>
        <el-button v-if="isManage" @click="deleteSelectData" type="primary">删除</el-button>
        <span class="new-queryTableSpan">{{ selectType }}</span>
      </div>
      <div class="new-queryTableDiv">
        <!--数据表格-->
        <el-form ref="formTable" :model="tableDataForm" style="height:100%;">
          <el-table v-loading="loading" ref="multipleTable" :data="tableDataForm.tableData" tooltip-effect="dark"
            height="100%" @selection-change="handleSelectionChange" :header-cell-style="{ textAlign: 'center' }"
            :cell-style="{ textAlign: 'center' }" stripe>
            <el-table-column v-if="isManage" type="selection" width="50"> </el-table-column>
            <!--地下管网czt_dx_pipe_network-->
            <template v-if="selectType == '地下管网'">
              <!--<el-table-column property="cdpnId" label="主键"></el-table-column>-->
              <el-table-column v-for="(item, index) in tableColumns1" :key="'type1.' + index + '.' + item.filedProp"
                :width="160" :prop="item.filedProp" :label="item.filedName">
                <template #default="scope">
                  <span v-if="!scope.row.isEdit">
                    {{ scope.row.dictItemNameObj[item.filedProp] }}
                  </span>
                  <el-form-item v-else :prop="'tableData.' + scope.$index + '.' + item.filedProp"
                    :rules="tableDataForm.rules1[item.filedProp]">
                    <el-select v-if="item.filedType == 'select'" v-model="scope.row[item.filedProp]"
                      @change="(value) => onChangeSelect(value, item.filedProp, scope.row)"
                      :disabled="item.readonly == 'readonly'" placeholder="请选择" clearable>
                      <el-option v-for="item in getDictArray(scope.row, item.filedProp, item.filedName, selectType)"
                        :key="item.code" :label="item.name" :value="item.code">
                      </el-option>
                    </el-select>
                    <el-input v-else-if="item.readonly == 'readonly'"
                      v-model.trim="scope.row.dictItemNameObj[item.filedProp]"
                      :disabled="item.readonly == 'readonly'"></el-input>
                    <el-input v-else v-model.trim="scope.row[item.filedProp]"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
            </template>
            <!--供水-水厂泵房czt_waterworks-->
            <template v-if="selectType == '供水-水厂泵房'">
              <!--<el-table-column property="cwId" label="主键"></el-table-column>-->
              <el-table-column v-for="(item, index) in tableColumns2" :key="'type2.' + index + '.' + item.filedProp"
                :width="160" :prop="item.filedProp" :label="item.filedName">
                <template #default="scope">
                  <span v-if="!scope.row.isEdit">
                    {{ scope.row.dictItemNameObj[item.filedProp] }}
                  </span>
                  <el-form-item v-else :prop="'tableData.' + scope.$index + '.' + item.filedProp"
                    :rules="tableDataForm.rules2[item.filedProp]">
                    <el-select v-if="item.filedType == 'select'" v-model="scope.row[item.filedProp]"
                      @change="(value) => onChangeSelect(value, item.filedProp, scope.row)"
                      :disabled="item.readonly == 'readonly'" placeholder="请选择" clearable>
                      <el-option v-for="item in getDictArray(scope.row, item.filedProp, item.filedName, selectType)"
                        :key="item.code" :label="item.name" :value="item.code">
                      </el-option>
                    </el-select>
                    <el-input v-else-if="item.readonly == 'readonly'"
                      v-model.trim="scope.row.dictItemNameObj[item.filedProp]"
                      :disabled="item.readonly == 'readonly'"></el-input>
                    <el-input v-else v-model.trim="scope.row[item.filedProp]"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
            </template>
            <!--供水-水厂水池czt_pool-->
            <template v-if="selectType == '供水-水厂水池'">
              <!--<el-table-column property="cpId" label="主键"></el-table-column>-->
              <el-table-column v-for="(item, index) in tableColumns3" :key="'type3.' + index + '.' + item.filedProp"
                :width="160" :prop="item.filedProp" :label="item.filedName">
                <template #default="scope">
                  <span v-if="!scope.row.isEdit">
                    {{ scope.row.dictItemNameObj[item.filedProp] }}
                  </span>
                  <el-form-item v-else :prop="'tableData.' + scope.$index + '.' + item.filedProp"
                    :rules="tableDataForm.rules3[item.filedProp]">
                    <el-select v-if="item.filedType == 'select'" v-model="scope.row[item.filedProp]"
                      @change="(value) => onChangeSelect(value, item.filedProp, scope.row)"
                      :disabled="item.readonly == 'readonly'" placeholder="请选择" clearable>
                      <el-option v-for="item in getDictArray(scope.row, item.filedProp, item.filedName, selectType)"
                        :key="item.code" :label="item.name" :value="item.code">
                      </el-option>
                    </el-select>
                    <el-input v-else-if="item.readonly == 'readonly'"
                      v-model.trim="scope.row.dictItemNameObj[item.filedProp]"
                      :disabled="item.readonly == 'readonly'"></el-input>
                    <el-input v-else v-model.trim="scope.row[item.filedProp]"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
            </template>
            <!--燃气-储气罐czt_air_receiver-->
            <template v-if="selectType == '燃气-储气罐'">
              <!--<el-table-column property="carId" label="主键"></el-table-column>-->
              <el-table-column v-for="(item, index) in tableColumns4" :key="'type4.' + index + '.' + item.filedProp"
                :width="160" :prop="item.filedProp" :label="item.filedName">
                <template #default="scope">
                  <span v-if="!scope.row.isEdit">
                    {{ scope.row.dictItemNameObj[item.filedProp] }}
                  </span>
                  <el-form-item v-else :prop="'tableData.' + scope.$index + '.' + item.filedProp"
                    :rules="tableDataForm.rules4[item.filedProp]">
                    <el-select v-if="item.filedType == 'select'" v-model="scope.row[item.filedProp]"
                      @change="(value) => onChangeSelect(value, item.filedProp, scope.row)"
                      :disabled="item.readonly == 'readonly'" placeholder="请选择" clearable>
                      <el-option v-for="item in getDictArray(scope.row, item.filedProp, item.filedName, selectType)"
                        :key="item.code" :label="item.name" :value="item.code">
                      </el-option>
                    </el-select>
                    <el-input v-else-if="item.readonly == 'readonly'"
                      v-model.trim="scope.row.dictItemNameObj[item.filedProp]"
                      :disabled="item.readonly == 'readonly'"></el-input>
                    <el-input v-else v-model.trim="scope.row[item.filedProp]"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
            </template>
            <!--交通-桥梁czt_bridge_point、czt_bridge_line-->
            <template v-if="selectType == '交通-桥梁'">
              <!--<el-table-column property="cbId" label="主键"></el-table-column>-->
              <el-table-column v-for="(item, index) in tableColumns5" :key="'type5.' + index + '.' + item.filedProp"
                :width="160" :prop="item.filedProp" :label="item.filedName">
                <template #default="scope">
                  <span v-if="!scope.row.isEdit">
                    {{ scope.row.dictItemNameObj[item.filedProp] }}
                  </span>
                  <el-form-item v-else :prop="'tableData.' + scope.$index + '.' + item.filedProp"
                    :rules="tableDataForm.rules5[item.filedProp]">
                    <el-select v-if="item.filedType == 'select'" v-model="scope.row[item.filedProp]"
                      @change="(value) => onChangeSelect(value, item.filedProp, scope.row)"
                      :disabled="item.readonly == 'readonly'" placeholder="请选择" clearable>
                      <el-option v-for="item in getDictArray(scope.row, item.filedProp, item.filedName, selectType)"
                        :key="item.code" :label="item.name" :value="item.code">
                      </el-option>
                    </el-select>
                    <el-input v-else-if="item.readonly == 'readonly'"
                      v-model.trim="scope.row.dictItemNameObj[item.filedProp]"
                      :disabled="item.readonly == 'readonly'"></el-input>
                    <el-input v-else v-model.trim="scope.row[item.filedProp]"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
            </template>
            <!--交通-道路czt_road-->
            <template v-if="selectType == '交通-道路'">
              <!--<el-table-column property="crId" label="主键"></el-table-column>-->
              <el-table-column v-for="(item, index) in tableColumns6" :key="'type6.' + index + '.' + item.filedProp"
                :width="160" :prop="item.filedProp" :label="item.filedName">
                <template #default="scope">
                  <span v-if="!scope.row.isEdit">
                    {{ scope.row.dictItemNameObj[item.filedProp] }}
                  </span>
                  <el-form-item v-else :prop="'tableData.' + scope.$index + '.' + item.filedProp"
                    :rules="tableDataForm.rules6[item.filedProp]">
                    <el-select v-if="item.filedType == 'select'" v-model="scope.row[item.filedProp]"
                      @change="(value) => onChangeSelect(value, item.filedProp, scope.row)"
                      :disabled="item.readonly == 'readonly'" placeholder="请选择" clearable>
                      <el-option v-for="item in getDictArray(scope.row, item.filedProp, item.filedName, selectType)"
                        :key="item.code" :label="item.name" :value="item.code">
                      </el-option>
                    </el-select>
                    <el-input v-else-if="item.readonly == 'readonly'"
                      v-model.trim="scope.row.dictItemNameObj[item.filedProp]"
                      :disabled="item.readonly == 'readonly'"></el-input>
                    <el-input v-else v-model.trim="scope.row[item.filedProp]"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
            </template>
            <!--电力-变电站czt_transformer_substation-->
            <template v-if="selectType == '电力-变电站'">
              <!--<el-table-column property="ctsId" label="主键"></el-table-column>-->
              <el-table-column v-for="(item, index) in tableColumns7" :key="'type7.' + index + '.' + item.filedProp"
                :width="160" :prop="item.filedProp" :label="item.filedName">
                <template #default="scope">
                  <span v-if="!scope.row.isEdit">
                    {{ scope.row.dictItemNameObj[item.filedProp] }}
                  </span>
                  <el-form-item v-else :prop="'tableData.' + scope.$index + '.' + item.filedProp"
                    :rules="tableDataForm.rules7[item.filedProp]">
                    <el-select v-if="item.filedType == 'select'" v-model="scope.row[item.filedProp]"
                      @change="(value) => onChangeSelect(value, item.filedProp, scope.row)"
                      :disabled="item.readonly == 'readonly'" placeholder="请选择" clearable>
                      <el-option v-for="item in getDictArray(scope.row, item.filedProp, item.filedName, selectType)"
                        :key="item.code" :label="item.name" :value="item.code">
                      </el-option>
                    </el-select>
                    <el-input v-else-if="item.readonly == 'readonly'"
                      v-model.trim="scope.row.dictItemNameObj[item.filedProp]"
                      :disabled="item.readonly == 'readonly'"></el-input>
                    <el-input v-else v-model.trim="scope.row[item.filedProp]"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
            </template>
            <!--电力-架空线路czt_overhead_line-->
            <template v-if="selectType == '电力-架空线路'">
              <!--<el-table-column property="colId" label="主键"></el-table-column>-->
              <el-table-column :label="superColumn.superColumnName" v-for="(superColumn, idx) in tableColumns8"
                :key="'type8.' + idx">
                <el-table-column v-for="(item, index) in superColumn.filedArray"
                  :key="'type8.' + idx + '.' + index + '.' + item.filedProp" :width="160" :prop="item.filedProp"
                  :label="item.filedName">
                  <template #default="scope">
                    <span v-if="!scope.row.isEdit">
                      {{ scope.row.dictItemNameObj[item.filedProp] }}
                    </span>
                    <el-form-item v-else :prop="'tableData.' + scope.$index + '.' + item.filedProp"
                      :rules="tableDataForm.rules8[item.filedProp]">
                      <el-select v-if="item.filedType == 'select'" v-model="scope.row[item.filedProp]"
                        @change="(value) => onChangeSelect(value, item.filedProp, scope.row)"
                        :disabled="item.readonly == 'readonly'" placeholder="请选择" clearable>
                        <el-option v-for="item in getDictArray(scope.row, item.filedProp, item.filedName, selectType)"
                          :key="item.code" :label="item.name" :value="item.code">
                        </el-option>
                      </el-select>
                      <el-input v-else-if="item.readonly == 'readonly'"
                        v-model.trim="scope.row.dictItemNameObj[item.filedProp]"
                        :disabled="item.readonly == 'readonly'"></el-input>
                      <el-input v-else v-model.trim="scope.row[item.filedProp]"></el-input>
                    </el-form-item>
                  </template>
                </el-table-column>
              </el-table-column>
            </template>
            <!--电力-电缆线路czt_cable_route-->
            <template v-if="selectType == '电力-电缆线路'">
              <!--<el-table-column property="ccrId" label="主键"></el-table-column>-->
              <el-table-column v-for="(item, index) in tableColumns9" :key="'type9.' + index + '.' + item.filedProp"
                :width="160" :prop="item.filedProp" :label="item.filedName">
                <template #default="scope">
                  <span v-if="!scope.row.isEdit">
                    {{ scope.row.dictItemNameObj[item.filedProp] }}
                  </span>
                  <el-form-item v-else :prop="'tableData.' + scope.$index + '.' + item.filedProp"
                    :rules="tableDataForm.rules9[item.filedProp]">
                    <el-select v-if="item.filedType == 'select'" v-model="scope.row[item.filedProp]"
                      @change="(value) => onChangeSelect(value, item.filedProp, scope.row)"
                      :disabled="item.readonly == 'readonly'" placeholder="请选择" clearable>
                      <el-option v-for="item in getDictArray(scope.row, item.filedProp, item.filedName, selectType)"
                        :key="item.code" :label="item.name" :value="item.code">
                      </el-option>
                    </el-select>
                    <el-input v-else-if="item.readonly == 'readonly'"
                      v-model.trim="scope.row.dictItemNameObj[item.filedProp]"
                      :disabled="item.readonly == 'readonly'"></el-input>
                    <el-input v-else v-model.trim="scope.row[item.filedProp]"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
            </template>
            <!--电力-重要发电厂房czt_important_powerhouse-->
            <template v-if="selectType == '电力-重要发电厂房'">
              <!--<el-table-column property="cipId" label="主键"></el-table-column>-->
              <el-table-column v-for="(item, index) in tableColumns10" :key="'type10.' + index + '.' + item.filedProp"
                :width="160" :prop="item.filedProp" :label="item.filedName">
                <template #default="scope">
                  <span v-if="!scope.row.isEdit">
                    {{ scope.row.dictItemNameObj[item.filedProp] }}
                  </span>
                  <el-form-item v-else :prop="'tableData.' + scope.$index + '.' + item.filedProp"
                    :rules="tableDataForm.rules10[item.filedProp]">
                    <el-select v-if="item.filedType == 'select'" v-model="scope.row[item.filedProp]"
                      @change="(value) => onChangeSelect(value, item.filedProp, scope.row)"
                      :disabled="item.readonly == 'readonly'" placeholder="请选择" clearable>
                      <el-option v-for="item in getDictArray(scope.row, item.filedProp, item.filedName, selectType)"
                        :key="item.code" :label="item.name" :value="item.code">
                      </el-option>
                    </el-select>
                    <el-input v-else-if="item.readonly == 'readonly'"
                      v-model.trim="scope.row.dictItemNameObj[item.filedProp]"
                      :disabled="item.readonly == 'readonly'"></el-input>
                    <el-input v-else v-model.trim="scope.row[item.filedProp]"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
            </template>
            <!--通信-通信室内设备czt_comm_indoor_equipment-->
            <template v-if="selectType == '通信-通信室内设备'">
              <!--<el-table-column property="ccieId" label="主键"></el-table-column>-->
              <el-table-column v-for="(item, index) in tableColumns11" :key="'type11.' + index + '.' + item.filedProp"
                :width="160" :prop="item.filedProp" :label="item.filedName">
                <template #default="scope">
                  <span v-if="!scope.row.isEdit">
                    {{ scope.row.dictItemNameObj[item.filedProp] }}
                  </span>
                  <el-form-item v-else :prop="'tableData.' + scope.$index + '.' + item.filedProp"
                    :rules="tableDataForm.rules11[item.filedProp]">
                    <el-select v-if="item.filedType == 'select'" v-model="scope.row[item.filedProp]"
                      @change="(value) => onChangeSelect(value, item.filedProp, scope.row)"
                      :disabled="item.readonly == 'readonly'" placeholder="请选择" clearable>
                      <el-option v-for="item in getDictArray(scope.row, item.filedProp, item.filedName, selectType)"
                        :key="item.code" :label="item.name" :value="item.code">
                      </el-option>
                    </el-select>
                    <el-input v-else-if="item.readonly == 'readonly'"
                      v-model.trim="scope.row.dictItemNameObj[item.filedProp]"
                      :disabled="item.readonly == 'readonly'"></el-input>
                    <el-input v-else v-model.trim="scope.row[item.filedProp]"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
            </template>
            <!--通信-电视塔czt_tv_tower-->
            <template v-if="selectType == '通信-电视塔'">
              <!--<el-table-column property="cttId" label="主键"></el-table-column>-->
              <el-table-column v-for="(item, index) in tableColumns12" :key="'type12.' + index + '.' + item.filedProp"
                :width="160" :prop="item.filedProp" :label="item.filedName">
                <template #default="scope">
                  <span v-if="!scope.row.isEdit">
                    {{ scope.row.dictItemNameObj[item.filedProp] }}
                  </span>
                  <el-form-item v-else :prop="'tableData.' + scope.$index + '.' + item.filedProp"
                    :rules="tableDataForm.rules12[item.filedProp]">
                    <el-select v-if="item.filedType == 'select'" v-model="scope.row[item.filedProp]"
                      @change="(value) => onChangeSelect(value, item.filedProp, scope.row)"
                      :disabled="item.readonly == 'readonly'" placeholder="请选择" clearable>
                      <el-option v-for="item in getDictArray(scope.row, item.filedProp, item.filedName, selectType)"
                        :key="item.code" :label="item.name" :value="item.code">
                      </el-option>
                    </el-select>
                    <el-input v-else-if="item.readonly == 'readonly'"
                      v-model.trim="scope.row.dictItemNameObj[item.filedProp]"
                      :disabled="item.readonly == 'readonly'"></el-input>
                    <el-input v-else v-model.trim="scope.row[item.filedProp]"></el-input>
                  </el-form-item>
                </template>
              </el-table-column>
            </template>
            <el-table-column v-if="isManage" label="操作" fixed="right" width="120">
              <template #default="scope">
                <el-button type="text" size="small" @click="handleModify(scope.$index, scope.row)"
                  :disabled="scope.row.createUser != currentUserId">
                  {{ scope.row.isEdit ? '应用' : '修改' }}
                </el-button>
                <el-button type="text" size="small" @click="handleDelete(scope.$index, scope.row)"
                  :disabled="scope.row.createUser != currentUserId">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-form>
      </div>
      <!--分页显示-->
      <div class="new-queryTableDiv-page">
        <el-pagination v-if="totalCount > 0 && showSelectId == false" v-model:current-page="currentPage"
          v-model:page-size="pageSize" layout="total, sizes, prev, pager, next, jumper" :total="totalCount"
          @current-change="handleCurrentChange" @size-change="handleSizeChange" />
      </div>
    </div>
  </el-collapse-transition>
</template>

<script setup>
import { queryByPage, findById, getValueByDictCodeAndKey, getValidDictItemsByDictCode, updateData, deleteData, bridgeDeleteData, bridgeFindById } from "@/api/map/basicDataManage/dzysxData.js";
import { reactive, toRefs } from "vue";
import { getInfo } from '@/api/login';
import { getUserId } from "@/utils/auth";
import { ElMessage, ElMessageBox } from 'element-plus';
import { getProvince, getChildArea } from "@/api/system/division";

const props = defineProps({
  isManage: {
    type: Boolean,
    default: false
  },
  queryParams: {
    type: Object,
    default: {}
  },
  selectType: {
    type: String,
    default: ''
  },
  //根据id查询1条数据
  selectId: {
    type: String,
    default: ''
  },
  //选中的1条数据
  selectData: {
    type: Array,
    default: []
  },
  showTable: {
    type: Boolean,
    default: false
  },
});

const { proxy } = getCurrentInstance();
const loading = ref(false);
const dataTypeArray = ref(["地下管网", "供水-水厂泵房", "供水-水厂水池", "燃气-储气罐", "交通-桥梁", "交通-道路", "电力-变电站", "电力-架空线路", "电力-电缆线路", "电力-重要发电厂房", "通信-通信室内设备", "通信-电视塔"]);
//分页显示表格数据
const currentPage = ref(1);//当前页码
const pageSize = ref(10);//每页显示数据数量
const totalCount = ref(0);//总数据数量
const multipleSelection = ref([]);//多选表格数据
const currentUserId = ref(null);//当前登录人ID
const provinceData = ref([]); //全部省
const allCityData = ref(new Map()); //全部市
const allCountyData = ref(new Map()); //全部区县
const showSelectId = ref(false);//是否显示1条数据详情

//验证是否正整数（非必填）
const isIntegerNotMust = (rule, value, callback) => {
  if (value == '' || value == undefined || value == null) {
    callback();
  } else if (isNaN(Number(value))) {
    callback(new Error('请输入正整数'));
  } else if (Number(value) < 0) {
    callback(new Error('请输入正整数'));
  } else if (Number(value).toString().indexOf(".") != -1) {
    callback(new Error('请输入正整数'));
  } else {
    callback();
  }
}

//验证是否正数（非必填）
const isNumberNotMust = (rule, value, callback) => {
  if (value == '' || value == undefined || value == null) {
    callback();
  } else if (isNaN(Number(value))) {
    callback(new Error('请输入正数'));
  } else if (Number(value) < 0) {
    callback(new Error('请输入正数'));
  } else {
    callback();
  }
}

//验证是否yyyy年份（非必填）
const isYearNotMust = (rule, value, callback) => {
  if (value == '' || value == undefined || value == null) {
    callback();
  } else if (isNaN(Number(value))) {
    callback(new Error('请输入yyyy格式如2022'));
  } else if (value.toString().length != 4) {
    callback(new Error('请输入yyyy格式如2022'));
  } else if (value.toString().indexOf(".") != -1) {
    callback(new Error('请输入yyyy格式如2022'));
  } else {
    callback();
  }
}

// 验证经度（非必填）
const validateLon = (rule, value, callback) => {
  let reg = /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g; // 整数或小数
  if (!value) {
    callback()
  } else if (!reg.test(value)) {
    callback(new Error('请输入正确数值'))
  } else if (value > 180) {
    callback(new Error('经度必须小于180'))
  } else if (value < 0) {
    callback(new Error('经度必须大于0'))
  } else if (value.indexOf(".") != -1 && value.split(".")[1].length > 15) {
    callback(new Error('最多保留15位小数'));
  } else {
    callback();
  }
}

// 验证纬度（非必填）
const validateLat = (rule, value, callback) => {
  let reg = /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g; // 整数或小数
  if (!value) {
    callback()
  } else if (!reg.test(value)) {
    callback(new Error('请输入正确数值'))
  } else if (value > 90) {
    callback(new Error('纬度必须小于90'))
  } else if (value < 0) {
    callback(new Error('纬度必须大于0'))
  } else if (value.indexOf(".") != -1 && value.split(".")[1].length > 15) {
    callback(new Error('最多保留15位小数'));
  } else {
    callback();
  }
}

const data = reactive({
  params: {
    province: "",
    city: "",
    county: "",
    type: "",//数据类型
    page: 1,
    rows: 10,
  },
  tableDataForm: {
    tableData: [],//表格数据
    //通用字段
    rules0: {
      province: [{ required: false, message: '请输入省', trigger: 'blur' },],
      city: [{ required: false, message: '请输入市', trigger: 'blur' },],
      county: [{ required: false, message: '请输入区县', trigger: 'blur' },],
      extends1: [{ required: false, message: '请输入extends1', trigger: 'blur' },],
      extends2: [{ required: false, message: '请输入extends2', trigger: 'blur' },],
      extends3: [{ required: false, message: '请输入extends3', trigger: 'blur' },],
      extends4: [{ required: false, message: '请输入extends4', trigger: 'blur' },],
      extends5: [{ required: false, message: '请输入extends5', trigger: 'blur' },],
      extends6: [{ required: false, message: '请输入extends6', trigger: 'blur' },],
      extends7: [{ required: false, message: '请输入extends7', trigger: 'blur' },],
      extends8: [{ required: false, message: '请输入extends8', trigger: 'blur' },],
      extends9: [{ required: false, message: '请输入extends9', trigger: 'blur' },],
      extends10: [{ required: false, message: '请输入extends10', trigger: 'blur' },],
    },
    //地下管网
    rules1: {
      id: [{ required: false, message: '请输入管道编码', trigger: 'blur' },],
      cdpnName: [{ required: true, message: '请输入管道名称', trigger: 'blur' },],
      cdpnClass: [{ required: true, message: '请输入管道类型', trigger: 'blur' },],
      startId: [{ required: true, message: '请输入起点编号', trigger: 'blur' }, { trigger: 'blur', validator: isIntegerNotMust }],
      endId: [{ required: true, message: '请输入终点编号', trigger: 'blur' }, { trigger: 'blur', validator: isIntegerNotMust }],
      longitude: [{ required: true, message: '请输入经度', trigger: 'blur' }, { trigger: 'blur', validator: validateLon }],
      latitude: [{ required: true, message: '请输入纬度', trigger: 'blur' }, { trigger: 'blur', validator: validateLat }],
      length: [{ required: true, message: '请输入管道长度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      material: [{ required: true, message: '请输入管材', trigger: 'change' },],
      materialType: [{ required: false, message: '请输入管材型号', trigger: 'blur' },],
      elasticModulus: [{ required: false, message: '请输入弹性模量', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      yieldLimitStress: [{ required: false, message: '请输入屈服极限应力', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      strengthLimitStress: [{ required: false, message: '请输入强度极限应力', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      permissibleStrain: [{ required: false, message: '请输入许用应变', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      diameter: [{ required: false, message: '请输入管道直径', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      thickness: [{ required: false, message: '请输入管道壁厚', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      pressure: [{ required: false, message: '请输入工作压力', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      joint: [{ required: false, message: '请输入接口形式', trigger: 'change' },],
      jointy: [{ required: false, message: '请输入接口材料', trigger: 'change' },],
      allowableElongation: [{ required: false, message: '请输入接口许用伸长', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      site: [{ required: false, message: '请输入场地类别', trigger: 'change' },],
      liquefaction6: [{ required: false, message: '请输入6度时液化程度', trigger: 'change' },],
      liquefaction7: [{ required: false, message: '请输入7度时液化程度', trigger: 'change' },],
      liquefaction8: [{ required: false, message: '请输入8度时液化程度', trigger: 'change' },],
      liquefaction9: [{ required: false, message: '请输入9度时液化程度', trigger: 'change' },],
      seismicSubsidence6: [{ required: false, message: '请输入6度时震陷程度', trigger: 'change' },],
      seismicSubsidence7: [{ required: false, message: '请输入7度时震陷程度', trigger: 'change' },],
      seismicSubsidence8: [{ required: false, message: '请输入8度时震陷程度', trigger: 'change' },],
      seismicSubsidence9: [{ required: false, message: '请输入9度时震陷程度', trigger: 'change' },],
      depth: [{ required: false, message: '请输入管道埋深', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      year: [{ required: false, message: '请输入建设年代', trigger: 'blur' }, { trigger: 'blur', validator: isYearNotMust }],
      intensity: [{ required: false, message: '请输入设防烈度', trigger: 'change' },],
    },
    //供水-水厂泵房
    rules2: {
      cwName: [{ required: true, message: '请输入水厂名称', trigger: 'blur' },],
      longitude: [{ required: true, message: '请输入经度', trigger: 'blur' }, { trigger: 'blur', validator: validateLon }],
      latitude: [{ required: true, message: '请输入纬度', trigger: 'blur' }, { trigger: 'blur', validator: validateLat }],
      id: [{ required: true, message: '请输入建筑物编码', trigger: 'blur' },],
      buildingName: [{ required: true, message: '请输入建筑物名称', trigger: 'blur' },],
      type: [{ required: true, message: '请输入结构类型', trigger: 'change' },],
      floors: [{ required: true, message: '请输入建筑层数', trigger: 'blur' }, { trigger: 'blur', validator: isIntegerNotMust }],
      area: [{ required: true, message: '请输入建筑面积', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      material: [{ required: false, message: '请输入混凝土等级', trigger: 'blur' },],
      materialType: [{ required: false, message: '请输入砖砌体标号', trigger: 'blur' },],
      site: [{ required: false, message: '请输入场地类别', trigger: 'change' },],
      liquefaction6: [{ required: false, message: '请输入6度时液化程度', trigger: 'change' },],
      liquefaction7: [{ required: false, message: '请输入7度时液化程度', trigger: 'change' },],
      liquefaction8: [{ required: false, message: '请输入8度时液化程度', trigger: 'change' },],
      liquefaction9: [{ required: false, message: '请输入9度时液化程度', trigger: 'change' },],
      seismicSubsidence6: [{ required: false, message: '请输入6度时震陷程度', trigger: 'change' },],
      seismicSubsidence7: [{ required: false, message: '请输入7度时震陷程度', trigger: 'change' },],
      seismicSubsidence8: [{ required: false, message: '请输入8度时震陷程度', trigger: 'change' },],
      seismicSubsidence9: [{ required: false, message: '请输入9度时震陷程度', trigger: 'change' },],
      year: [{ required: false, message: '请输入建设年代', trigger: 'blur' }, { trigger: 'blur', validator: isYearNotMust }],
      intensity: [{ required: false, message: '请输入设防烈度', trigger: 'change' },],
    },
    //供水-水厂水池
    rules3: {
      id: [{ required: true, message: '请输入水池编码', trigger: 'blur' },],
      style: [{ required: true, message: '请输入结构形式', trigger: 'change' },],
      material: [{ required: true, message: '请输入结构材料', trigger: 'change' },],
      thickness: [{ required: true, message: '请输入水池壁厚', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      shape: [{ required: true, message: '请输入水池形状', trigger: 'change' },],
      radius: [{ required: true, message: '请输入水池半径', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      slength: [{ required: true, message: '请输入水池短边', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      length: [{ required: true, message: '请输入水池长边', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      capacity: [{ required: true, message: '请输入容量', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      depth: [{ required: true, message: '请输入水深度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      height: [{ required: true, message: '请输入水池高度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      joint: [{ required: false, message: '请输入矩形水池顶盖整体性是否良好，与池壁、立柱是否有可靠连接', trigger: 'blur' },],
      present: [{ required: false, message: '请输入使用现状', trigger: 'blur' },],
      quality: [{ required: false, message: '请输入施工质量', trigger: 'blur' },],
      surfaceShape1: [{ required: false, message: '请输入池壁内侧竖向配筋表面形状', trigger: 'change' },],
      surfaceShape2: [{ required: false, message: '请输入池壁外侧竖向配筋表面形状', trigger: 'change' },],
      diameter1: [{ required: false, message: '请输入池壁内侧竖向配筋直径', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      diameter2: [{ required: false, message: '请输入池壁外侧竖向配筋直径', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      strengthGrade: [{ required: false, message: '请输入混凝土强度等级', trigger: 'blur' },],
      kinds1: [{ required: false, message: '请输入池壁内侧竖向钢筋等级', trigger: 'change' },],
      kinds2: [{ required: false, message: '请输入池壁外侧竖向钢筋等级', trigger: 'change' },],
      thicknessLayer1: [{ required: false, message: '请输入池壁内侧最外层钢筋保护层厚度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      thicknessLayer2: [{ required: false, message: '请输入池壁外侧最外层钢筋保护层厚度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      innerReinforcement: [{ required: false, message: '请输入池壁内侧竖向配筋', trigger: 'blur' },],
      outReinforcement: [{ required: false, message: '请输入池壁外侧竖向配筋', trigger: 'blur' },],
      intensity: [{ required: false, message: '请输入设防烈度', trigger: 'change' },],
      site: [{ required: false, message: '请输入场地类别', trigger: 'change' },],
      year: [{ required: false, message: '请输入建设年代', trigger: 'blur' }, { trigger: 'blur', validator: isYearNotMust }],
      liquefaction6: [{ required: false, message: '请输入6度时液化程度', trigger: 'change' },],
      liquefaction7: [{ required: false, message: '请输入7度时液化程度', trigger: 'change' },],
      liquefaction8: [{ required: false, message: '请输入8度时液化程度', trigger: 'change' },],
      liquefaction9: [{ required: false, message: '请输入9度时液化程度', trigger: 'change' },],
      landform6: [{ required: false, message: '请输入6度时震陷程度', trigger: 'change' },],
      landform7: [{ required: false, message: '请输入7度时震陷程度', trigger: 'change' },],
      landform8: [{ required: false, message: '请输入8度时震陷程度', trigger: 'change' },],
      landform9: [{ required: false, message: '请输入9度时震陷程度', trigger: 'change' },],
    },
    //燃气-储气罐
    rules4: {
      id: [{ required: false, message: '请输入储气罐编码', trigger: 'blur' },],
      carName: [{ required: true, message: '请输入储气罐名称', trigger: 'blur' },],
      longitude: [{ required: true, message: '请输入经度', trigger: 'blur' }, { trigger: 'blur', validator: validateLon }],
      latitude: [{ required: true, message: '请输入纬度', trigger: 'blur' }, { trigger: 'blur', validator: validateLat }],
      style: [{ required: true, message: '请输入型号', trigger: 'blur' },],
      capacity: [{ required: true, message: '请输入公称容积', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      pressure: [{ required: true, message: '请输入工作压力', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      innerDiameter: [{ required: true, message: '请输入筒体内径', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      height: [{ required: true, message: '请输入筒体高度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      thickness: [{ required: true, message: '请输入筒体、封头壁厚', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      weight: [{ required: true, message: '请输入参考重量', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      material: [{ required: true, message: '请输入结构材料', trigger: 'blur' },],
      railLength: [{ required: true, message: '请输入导轨长度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      railHeight: [{ required: true, message: '请输入导轨高度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      railThickness: [{ required: true, message: '请输入导轨中腹厚度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      baseType: [{ required: true, message: '请输入基础形式', trigger: 'blur' },],
      materialType: [{ required: false, message: '请输入材料型号', trigger: 'blur' },],
      elasticModulus: [{ required: false, message: '请输入弹性模量', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      yieldStress: [{ required: false, message: '请输入屈服应力', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      permissibleStress: [{ required: false, message: '请输入许用应力', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      site: [{ required: false, message: '请输入场地类别', trigger: 'change' },],
      liquefaction6: [{ required: false, message: '请输入6度时液化程度', trigger: 'change' },],
      liquefaction7: [{ required: false, message: '请输入7度时液化程度', trigger: 'change' },],
      liquefaction8: [{ required: false, message: '请输入8度时液化程度', trigger: 'change' },],
      liquefaction9: [{ required: false, message: '请输入9度时液化程度', trigger: 'change' },],
      seismicSubsidence6: [{ required: false, message: '请输入6度时震陷程度', trigger: 'change' },],
      seismicSubsidence7: [{ required: false, message: '请输入7度时震陷程度', trigger: 'change' },],
      seismicSubsidence8: [{ required: false, message: '请输入8度时震陷程度', trigger: 'change' },],
      seismicSubsidence9: [{ required: false, message: '请输入9度时震陷程度', trigger: 'change' },],
      year: [{ required: false, message: '请输入建设年代', trigger: 'blur' }, { trigger: 'blur', validator: isYearNotMust }],
      intensity: [{ required: false, message: '请输入设防烈度', trigger: 'change' },],
    },
    //交通-桥梁
    rules5: {
      id: [{ required: false, message: '请输入编码', trigger: 'blur' },],
      cbName: [{ required: true, message: '请输入桥梁名称', trigger: 'blur' },],
      location: [{ required: true, message: '请输入所在位置', trigger: 'blur' },],
      acrossObject: [{ required: true, message: '请输入跨越地物名称', trigger: 'change' },],
      intensity: [{ required: true, message: '请输入抗震设防烈度', trigger: 'change' },],
      buildYear: [{ required: true, message: '请输入建造年代', trigger: 'blur' },],
      structure: [{ required: true, message: '请输入桥梁结构类型', trigger: 'change' },],
      maxSpan: [{ required: true, message: '请输入最大跨径', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      length: [{ required: true, message: '请输入跨径总长', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      siteSoil: [{ required: true, message: '请输入场地土分类', trigger: 'change' },],
      grade: [{ required: true, message: '请输入桥梁等级', trigger: 'change' },],
      foundationFail: [{ required: false, message: '请输入地基失效程度', trigger: 'change' },],
      superStructure: [{ required: false, message: '请输入上部结构', trigger: 'change' },],
      bearing: [{ required: false, message: '请输入支座形式', trigger: 'change' },],
      pierHeight: [{ required: false, message: '请输入桥墩高度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      pierMaterial: [{ required: false, message: '请输入桥墩材料', trigger: 'change' },],
      basement: [{ required: false, message: '请输入基础型式', trigger: 'change' },],
      capacity: [{ required: false, message: '请输入最大载重量', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      abutmentMat: [{ required: false, message: '请输入桥台材料', trigger: 'change' },],
      abutmentType: [{ required: false, message: '请输入桥台类型', trigger: 'change' },],
      expansionJoint: [{ required: false, message: '请输入伸缩缝数量', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      width: [{ required: false, message: '请输入桥梁宽度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      note: [{ required: false, message: '请输入简介', trigger: 'blur' },],
    },
    //交通-道路
    rules6: {
      id: [{ required: false, message: '请输入编码', trigger: 'blur' },],
      crName: [{ required: true, message: '请输入道路名称', trigger: 'blur' },],
      crClass: [{ required: true, message: '请输入道路等级', trigger: 'change' },],
      cover: [{ required: true, message: '请输入区间', trigger: 'blur' },],
      roadbedSoil: [{ required: true, message: '请输入路基土', trigger: 'change' },],
      siteSoil: [{ required: true, message: '请输入场地类别', trigger: 'change' },],
      fortification: [{ required: true, message: '请输入设防情况', trigger: 'change' },],
      foundationFail: [{ required: false, message: '请输入地基失效', trigger: 'change' },],
      roadbedType: [{ required: false, message: '请输入路基类型', trigger: 'change' },],
      roadbedHigh: [{ required: false, message: '请输入路基高差', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      capacity: [{ required: false, message: '请输入最大载重量', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      pavement: [{ required: false, message: '请输入路面类型', trigger: 'change' },],
      length: [{ required: false, message: '请输入总里程', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      width: [{ required: false, message: '请输入宽度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      note: [{ required: false, message: '请输入简介', trigger: 'blur' },],
    },
    //电力-变电站
    rules7: {
      id: [{ required: false, message: '请输入变电站编码', trigger: 'blur' },],
      ctsName: [{ required: true, message: '请输入变电站名称', trigger: 'blur' },],
      position: [{ required: true, message: '请输入变电站位置', trigger: 'blur' },],
      longitude: [{ required: true, message: '请输入经度', trigger: 'blur' }, { trigger: 'blur', validator: validateLon }],
      latitude: [{ required: true, message: '请输入纬度', trigger: 'blur' }, { trigger: 'blur', validator: validateLat }],
      typeSubstation: [{ required: true, message: '请输入变电站类型', trigger: 'blur' },],
      voltageGrade: [{ required: true, message: '请输入变电站电压等级', trigger: 'blur' },],
      structureType: [{ required: true, message: '请输入主控室房屋结构类型', trigger: 'change' },],
      fortificationIntensity: [{ required: false, message: '请输入设防烈度', trigger: 'change' },],
      substationTotalCost: [{ required: false, message: '请输入变电站总造价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      costHighVoltageOutdoor: [{ required: false, message: '请输入室外高压电气设备总造价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      costIndoorEquipment: [{ required: false, message: '请输入室内设备总造价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      costBuilding: [{ required: false, message: '请输入房屋建筑总造价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      year: [{ required: false, message: '请输入建设年代', trigger: 'blur' }, { trigger: 'blur', validator: isYearNotMust }],
      site: [{ required: false, message: '请输入场地类别', trigger: 'change' },],
    },
    //电力-架空线路
    rules8: {
      id: [{ required: false, message: '请输入评价单元编码', trigger: 'blur' },],
      colName: [{ required: true, message: '请输入评价单元名称', trigger: 'blur' },],
      fortificationIntensity: [{ required: true, message: '请输入评价单元设防烈度', trigger: 'change' },],
      // lineType: [{required: true, message: '请输入评价单元内线路类型', trigger: 'blur'},],
      //评价单元内35KV线路
      voltageGrade35: [{ required: true, message: '请输入线路电压等级', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      lineLength35: [{ required: true, message: '请输入线路总长度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      loopLength35: [{ required: true, message: '请输入回路总长度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      landform35: [{ required: true, message: '请输入地形地貌', trigger: 'change' },],
      unitCostLine35: [{ required: true, message: '请输入每公里线路总体造价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      type35: [{ required: false, message: '请输入杆塔类型', trigger: 'change' },],
      number35: [{ required: false, message: '请输入杆塔数量', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      unitCostTower35: [{ required: false, message: '请输入杆塔单价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      //评价单元内66KV线路
      voltageGrade66: [{ required: true, message: '请输入线路电压等级', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      lineLength66: [{ required: true, message: '请输入线路总长度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      loopLength66: [{ required: true, message: '请输入回路总长度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      landform66: [{ required: true, message: '请输入地形地貌', trigger: 'change' },],
      unitCostLine66: [{ required: true, message: '请输入每公里线路总体造价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      type66: [{ required: false, message: '请输入杆塔类型', trigger: 'change' },],
      number66: [{ required: false, message: '请输入杆塔数量', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      unitCostTower66: [{ required: false, message: '请输入杆塔单价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      //评价单元内110KV线路
      voltageGrade110: [{ required: true, message: '请输入线路电压等级', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      lineLength110: [{ required: true, message: '请输入线路总长度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      loopLength110: [{ required: true, message: '请输入回路总长度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      landform110: [{ required: true, message: '请输入地形地貌', trigger: 'change' },],
      unitCostLine110: [{ required: true, message: '请输入每公里线路总体造价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      type110: [{ required: false, message: '请输入杆塔类型', trigger: 'change' },],
      number110: [{ required: false, message: '请输入杆塔数量', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      unitCostTower110: [{ required: false, message: '请输入杆塔单价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      //评价单元内220KV线路
      voltageGrade220: [{ required: true, message: '请输入线路电压等级', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      lineLength220: [{ required: true, message: '请输入线路总长度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      loopLength220: [{ required: true, message: '请输入回路总长度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      landform220: [{ required: true, message: '请输入地形地貌', trigger: 'change' },],
      unitCostLine220: [{ required: true, message: '请输入每公里线路总体造价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      type220: [{ required: false, message: '请输入杆塔类型', trigger: 'change' },],
      number220: [{ required: false, message: '请输入杆塔数量', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      unitCostTower220: [{ required: false, message: '请输入杆塔单价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      //评价单元内330KV线路
      voltageGrade330: [{ required: true, message: '请输入线路电压等级', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      lineLength330: [{ required: true, message: '请输入线路总长度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      loopLength330: [{ required: true, message: '请输入回路总长度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      landform330: [{ required: true, message: '请输入地形地貌', trigger: 'change' },],
      unitCostLine330: [{ required: true, message: '请输入每公里线路总体造价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      type330: [{ required: false, message: '请输入杆塔类型', trigger: 'change' },],
      number330: [{ required: false, message: '请输入杆塔数量', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      unitCostTower330: [{ required: false, message: '请输入杆塔单价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      //评价单元内500KV线路
      voltageGrade500: [{ required: true, message: '请输入线路电压等级', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      lineLength500: [{ required: true, message: '请输入线路总长度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      loopLength500: [{ required: true, message: '请输入回路总长度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      landform500: [{ required: true, message: '请输入地形地貌', trigger: 'change' },],
      unitCostLine500: [{ required: true, message: '请输入每公里线路总体造价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      type500: [{ required: false, message: '请输入杆塔类型', trigger: 'change' },],
      number500: [{ required: false, message: '请输入杆塔数量', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      unitCostTower500: [{ required: false, message: '请输入杆塔单价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
    },
    //电力-电缆线路
    rules9: {
      id: [{ required: false, message: '请输入评价单元编码', trigger: 'blur' },],
      ccrName: [{ required: true, message: '请输入评价单元名称', trigger: 'blur' },],
      fortificationIntensity: [{ required: true, message: '请输入评价单元设防烈度', trigger: 'change' },],
      lineLength: [{ required: true, message: '请输入线路总长度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      costLine: [{ required: true, message: '请输入所有电缆线路总体造价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
    },
    //电力-重要发电厂房
    rules10: {
      id: [{ required: false, message: '请输入电厂编码', trigger: 'blur' },],
      cipName: [{ required: true, message: '请输入电厂名称', trigger: 'blur' },],
      position: [{ required: true, message: '请输入位置', trigger: 'blur' },],
      longitude: [{ required: true, message: '请输入经度', trigger: 'blur' }, { trigger: 'blur', validator: validateLon }],
      latitude: [{ required: true, message: '请输入纬度', trigger: 'blur' }, { trigger: 'blur', validator: validateLat }],
      year: [{ required: true, message: '请输入建设年份', trigger: 'blur' }, { trigger: 'blur', validator: isYearNotMust }],
      fortificationIntensity: [{ required: true, message: '请输入设防烈度', trigger: 'change' },],
      installedCapacity: [{ required: true, message: '请输入装机容量', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      generatingType: [{ required: true, message: '请输入发电类型', trigger: 'change' },],
      costPowerPlant: [{ required: true, message: '请输入发电厂总造价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      costSubstationEquipment: [{ required: true, message: '请输入变电设备造价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      costGeneratingEquipment: [{ required: true, message: '请输入发电设备总造价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      areaSteelStructures: [{ required: true, message: '请输入钢结构类建构筑物面积', trigger: 'blur' },],
      unitCostSteelStructure: [{ required: true, message: '请输入钢结构类建构筑物单价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      areaReinforcedConcrete: [{ required: true, message: '请输入钢筋混凝土类建构筑物面积', trigger: 'blur' },],
      unitCostReinforcedConcrete: [{ required: true, message: '请输入钢筋混凝土类建构筑物单价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      areaMasonryStructure: [{ required: true, message: '请输入砖混结构类建构筑物面积', trigger: 'blur' },],
      unitCostmasonryStructure: [{ required: true, message: '请输入砖混结构类建构筑物单价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
    },
    //通信-通信室内设备
    rules11: {
      inObjectName: [{ required: true, message: '请输入所属建筑物名称', trigger: 'blur' },],
      location: [{ required: true, message: '请输入所属建筑物地址位置', trigger: 'blur' },],
      objectLon: [{ required: true, message: '请输入所属建筑物地理经度坐标', trigger: 'blur' }, { trigger: 'blur', validator: validateLon }],
      objectLat: [{ required: true, message: '请输入所属建筑物地理纬度坐标', trigger: 'blur' }, { trigger: 'blur', validator: validateLat }],
      deviceType: [{ required: true, message: '请输入设备类别', trigger: 'blur' },],
      deviceName: [{ required: true, message: '请输入设备名称', trigger: 'blur' },],
      model: [{ required: true, message: '请输入型号', trigger: 'blur' },],
      inFloor: [{ required: true, message: '请输入所在楼层', trigger: 'blur' }, { trigger: 'blur', validator: isIntegerNotMust }],
      fixedForm: [{ required: true, message: '请输入设备固定形式', trigger: 'blur' },],
      boltDiameter: [{ required: false, message: '请输入底部螺栓直径', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      purchaseCost: [{ required: false, message: '请输入重新购置的造价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      manufacturers: [{ required: false, message: '请输入厂家', trigger: 'blur' },],
      size: [{ required: false, message: '请输入尺寸', trigger: 'blur' },],
      weight: [{ required: false, message: '请输入重量', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
    },
    //通信-电视塔
    rules12: {
      objectName: [{ required: true, message: '请输入电视塔名称', trigger: 'blur' },],
      location: [{ required: true, message: '请输入地址位置', trigger: 'blur' },],
      objectLon: [{ required: true, message: '请输入地理经度坐标', trigger: 'blur' }, { trigger: 'blur', validator: validateLon }],
      objectLat: [{ required: true, message: '请输入地理纬度坐标', trigger: 'blur' }, { trigger: 'blur', validator: validateLat }],
      cttType: [{ required: true, message: '请输入结构类型', trigger: 'blur' },],
      area: [{ required: true, message: '请输入建筑面积', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      year: [{ required: true, message: '请输入建造年代', trigger: 'blur' }, { trigger: 'blur', validator: isYearNotMust }],
      height: [{ required: true, message: '请输入总高度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      towerElevation: [{ required: true, message: '请输入塔楼处标高', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      buldingSite: [{ required: true, message: '请输入建筑物场址', trigger: 'blur' },],
      designIntensity: [{ required: true, message: '请输入设防标准', trigger: 'change' },],
      fieldType: [{ required: true, message: '请输入场地类型', trigger: 'change' },],
      status: [{ required: false, message: '请输入现状评价', trigger: 'blur' },],
      reconstructionCost: [{ required: false, message: '请输入重建单位面积造价', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      antennaElevation: [{ required: false, message: '请输入天线处标高', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      period: [{ required: false, message: '请输入基本周期', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
      colmnType: [{ required: false, message: '请输入塔柱结构类型', trigger: 'blur' },],
      baseType: [{ required: false, message: '请输入塔座结构类型', trigger: 'blur' },],
      baseStoryNum: [{ required: false, message: '请输入塔座层数', trigger: 'blur' }, { trigger: 'blur', validator: isIntegerNotMust }],
      baseHeight: [{ required: false, message: '请输入塔座高度', trigger: 'blur' }, { trigger: 'blur', validator: isNumberNotMust }],
    },
  },
});
const {
  params, tableDataForm,
} = toRefs(data);

//查询
watch(() => props.showTable, val => {
  if (val) {
    params.value.province = props.queryParams.province;
    params.value.city = props.queryParams.city;
    params.value.county = props.queryParams.county;
    let type = dataTypeArray.value.indexOf(props.selectType) + 1;
    params.value.type = type;
    //查询数据
    queryTableData();
  }
}, { deep: true, immediate: true });

const emits = defineEmits(['closeTableDiv']);
//关闭
const closeTableDiv = () => {
  emits("closeTableDiv");
}

//分页
const handleSizeChange = (val) => {
  // 改变每页显示的条数
  pageSize.value = val;
  // 注意：在改变每页显示的条数时，要将页码显示到第一页
  currentPage.value = 1;
  queryTableData();
};
const handleCurrentChange = (val) => {
  currentPage.value = val;
  queryTableData();
};

//查询数据
function queryTableData() {
  let id = props.selectId;
  if (id === "" || id == null) {//查询全部
    showSelectId.value = false;
    //分页查询数据
    queryTableDataByPage();
  } else {//根据ID查询
    showSelectId.value = true;
    queryTableDataById();
  }
}

//分页查询数据
function queryTableDataByPage() {
  params.value.page = currentPage.value;
  params.value.rows = pageSize.value;
  let selectType = props.selectType;
  let typeIndex = dataTypeArray.value.indexOf(selectType);
  let allTableColumnsArray = allTableColumns.value;
  let tableColumnsArray = allTableColumnsArray[typeIndex];
  //数据查询
  loading.value = true;
  //分页查询
  queryByPage(params.value).then((response) => {
    nextTick(() => {
      let result = response.data.rows;
      if (result && result.length > 0) {
        for (let i = 0; i < result.length; i++) {
          result[i].isEdit = false;//是否编辑状态
          //创建字典值对象
          result[i].dictItemNameObj = Object.create(null);
          if (selectType == "电力-架空线路") {
            // { superColumnName:"评价单元信息(精确到县区）", filedArray:[
            for (let j = 0; j < tableColumnsArray.length; j++) {
              let superColumnName = tableColumnsArray[j].superColumnName;
              let filedArray = tableColumnsArray[j].filedArray;
              for (let k = 0; k < filedArray.length; k++) {
                let filedProp = filedArray[k].filedProp;
                let filedName = filedArray[k].filedName;
                /*let filedValue = result[i][filedProp];
                if(filedValue && typeof filedValue==="string"){
                  let trimValue = filedValue.trim();//去除两侧空格
                  result[i][filedProp] = trimValue;
                }*/
                let dictItemName = dictChange(i, result[i], filedProp, filedName, selectType);
                //获取字典值
                result[i].dictItemNameObj[filedProp] = dictItemName;
              }
            }
          } else {
            for (let j = 0; j < tableColumnsArray.length; j++) {
              let filedProp = tableColumnsArray[j].filedProp;
              let filedName = tableColumnsArray[j].filedName;
              /*let filedValue = result[i][filedProp];
              if(filedValue && typeof filedValue==="string"){
                let trimValue = filedValue.trim();//去除两侧空格
                result[i][filedProp] = trimValue;
              }*/
              let dictItemName = dictChange(i, result[i], filedProp, filedName, selectType);
              //获取字典值
              result[i].dictItemNameObj[filedProp] = dictItemName;
            }
          }
        }
        tableDataForm.value.tableData = result;
        console.log('222', result, tableColumnsArray)
      } else {
        tableDataForm.value.tableData = [];
      }
      totalCount.value = response.data.total;
      loading.value = false;
      multipleSelection.value = [];//清空多选
    });
  }).catch(err => {
    totalCount.value = 0;
    tableDataForm.value.tableData = [];
    multipleSelection.value = [];//清空多选
    loading.value = false;
  });
}

//根据ID查询数据
function queryTableDataById() {
  let id = props.selectId;
  let type = dataTypeArray.value.indexOf(props.selectType) + 1;
  let selectType = props.selectType;
  let typeIndex = dataTypeArray.value.indexOf(selectType);
  let allTableColumnsArray = allTableColumns.value;
  let tableColumnsArray = allTableColumnsArray[typeIndex];
  //数据查询
  loading.value = true;
  if (type == "5") {//桥梁类型
    let flag = null;
    if (props.selectData.length == 1) {
      flag = props.selectData[0].flag;
    }
    if (flag == null) {
      return;
    }
    //查询
    bridgeFindById(id, flag).then((response) => {
      nextTick(() => {
        let result = [];
        if (response.data) {
          result = [response.data];
        }
        if (result && result.length > 0) {
          for (let i = 0; i < result.length; i++) {
            result[i].isEdit = false;//是否编辑状态
            //创建字典值对象
            result[i].dictItemNameObj = Object.create(null);
            for (let j = 0; j < tableColumnsArray.length; j++) {
              let filedArray = tableColumnsArray[j].filedArray;
              if (filedArray && filedArray.length > 0) {
                for (let k = 0; k < filedArray.length; k++) {
                  let filedProp = filedArray[k].filedProp;
                  let filedName = filedArray[k].filedName;
                  let dictItemName = dictChange(i, result[i], filedProp, filedName, selectType);
                  //获取字典值
                  result[i].dictItemNameObj[filedProp] = dictItemName;
                }
              } else {
                let filedProp = tableColumnsArray[j].filedProp;
                let filedName = tableColumnsArray[j].filedName;
                let dictItemName = dictChange(i, result[i], filedProp, filedName, selectType);
                //获取字典值
                result[i].dictItemNameObj[filedProp] = dictItemName;
              }
            }
          }
          tableDataForm.value.tableData = result;
        } else {
          tableDataForm.value.tableData = [];
        }
        totalCount.value = response.data.total;
        loading.value = false;
        multipleSelection.value = [];//清空多选
      });
    }).catch(err => {
      totalCount.value = 0;
      tableDataForm.value.tableData = [];
      multipleSelection.value = [];//清空多选
      loading.value = false;
    });
  } else {
    //查询
    findById(id, type).then((response) => {
      nextTick(() => {
        let result = [];
        if (response.data) {
          result = [response.data];
        }
        if (result && result.length > 0) {
          for (let i = 0; i < result.length; i++) {
            result[i].isEdit = false;//是否编辑状态
            //创建字典值对象
            result[i].dictItemNameObj = Object.create(null);
            for (let j = 0; j < tableColumnsArray.length; j++) {
              let filedArray = tableColumnsArray[j].filedArray;
              if (filedArray && filedArray.length > 0) {
                for (let k = 0; k < filedArray.length; k++) {
                  let filedProp = filedArray[k].filedProp;
                  let filedName = filedArray[k].filedName;
                  let dictItemName = dictChange(i, result[i], filedProp, filedName, selectType);
                  //获取字典值
                  result[i].dictItemNameObj[filedProp] = dictItemName;
                }
              } else {
                let filedProp = tableColumnsArray[j].filedProp;
                let filedName = tableColumnsArray[j].filedName;
                let dictItemName = dictChange(i, result[i], filedProp, filedName, selectType);
                //获取字典值
                result[i].dictItemNameObj[filedProp] = dictItemName;
              }
            }
          }
          tableDataForm.value.tableData = result;
        } else {
          tableDataForm.value.tableData = [];
        }
        totalCount.value = response.data.total;
        loading.value = false;
        multipleSelection.value = [];//清空多选
      });
    }).catch(err => {
      totalCount.value = 0;
      tableDataForm.value.tableData = [];
      multipleSelection.value = [];//清空多选
      loading.value = false;
    });
  }
}

// 转换时间
function getFormatTime(time) {
  if (time && time !== "") {
    let d = new Date(time);
    let year = d.getFullYear();
    let month = d.getMonth() + 1;
    if (month < 10) month = "0" + month;
    let date = d.getDate();
    if (date < 10) date = "0" + date;
    let hours = d.getHours();
    if (hours < 10) hours = "0" + hours;
    let minutes = d.getMinutes();
    if (minutes < 10) minutes = "0" + minutes;
    let seconds = d.getSeconds();
    if (seconds < 10) seconds = "0" + seconds;
    let newTime = year + "-" + month + "-" + date + " " + hours + ":" + minutes + ":" + seconds;
    return newTime;
  } else {
    return "";
  }
}

//数据解析
const dictChange = (index, data, col, colName, dataType) => {
  if (col == "createUser" || col == "updateUser") {
    // 获取用户名
    return getUserInfo(index, data, col);
  } else if (col == "createTime" || col == "updateTime") {
    // 格式化时间
    return getFormatTime(data[col]);
  } else {
    let dictArr = getDictArray(data, col, colName, dataType);
    if (data[col] != null && dictArr != null && dictArr.length > 0) {
      let code = data[col];
      /*if(code && typeof code==="string"){
        let trimValue = code.trim();//去除两侧空格
        code = trimValue;
      }*/
      for (let item of dictArr) {
        if (item.code == code) {
          //字典值
          return item.name;
        }
      }
    }
  }

  return data[col];
}

//字典表信息数组
const dictInfoArray = ref([
  { dictCode: "smxdxgwgc", dictName: "生命线-地下管网-管材" },
  { dictCode: "smxdxgwjkxs", dictName: "生命线-地下管网-接口形式" },
  { dictCode: "smxdxgwjkcl", dictName: "生命线-地下管网-接口材料" },
  { dictCode: "smxyhcd", dictName: "生命线-液化程度和震陷程度" },
  { dictCode: "smxscbfjglx", dictName: "生命线-水厂泵房-结构类型" },
  { dictCode: "smxscscjgxs", dictName: "生命线-水厂水池-结构形式" },
  { dictCode: "smxscscjgcl", dictName: "生命线-水厂水池-结构材料" },
  { dictCode: "smxscsccbsxpjbmxz", dictName: "生命线-水厂水池-池壁内侧/外侧竖向配筋表面形状" },
  { dictCode: "smxscsccbsxgjdj", dictName: "生命线-水厂水池-池壁内侧/外侧竖向钢筋等级" },
  { dictCode: "smxscscscxz", dictName: "生命线-水厂水池-水池形状" },
  { dictCode: "smxqlkydwmc", dictName: "生命线-桥梁-跨越地物名称" },
  { dictCode: "smxqljglx", dictName: "生命线-桥梁-桥梁结构类型" },
  { dictCode: "smxqldj", dictName: "生命线-桥梁-桥梁等级" },
  { dictCode: "smxqldjsxcd", dictName: "生命线-桥梁-地基失效程度" },
  { dictCode: "smxqlsbjg", dictName: "生命线-桥梁-上部结构" },
  { dictCode: "smxqlzzxs", dictName: "生命线-桥梁-支座形式" },
  { dictCode: "smxqljcxs", dictName: "生命线-桥梁-基础型式" },
  { dictCode: "smxqlqdcl", dictName: "生命线-桥梁-桥墩材料/桥台材料" },
  { dictCode: "smxqlqtlx", dictName: "生命线-桥梁-桥台类型" },
  { dictCode: "smxdldj", dictName: "生命线-道路-道路等级" },
  { dictCode: "smxdlljt", dictName: "生命线-道路-路基土" },
  { dictCode: "smxdlsfqk", dictName: "生命线-道路-设防情况" },
  { dictCode: "smxdldjsx", dictName: "生命线-道路-地基失效" },
  { dictCode: "smxdlljlx", dictName: "生命线-道路-路基类型" },
  { dictCode: "smxdllmlx", dictName: "生命线-道路-路面类型" },
  { dictCode: "smxbdzzkfwjglx", dictName: "生命线-变电站-主控室房屋结构类型" },
  { dictCode: "smxbdztglx", dictName: "生命线-架空线路-杆塔类型" },
  { dictCode: "smxbdzdxdm", dictName: "生命线-架空线路-地形地貌" },
  { dictCode: "smxfdcffdlx", dictName: "生命线-发电厂房-发电类型" },
  { dictCode: "smxsfld", dictName: "生命线-设防烈度" },
  { dictCode: "smxcdlb", dictName: "生命线-场地类别" },
]);
//全部字典表数组
const allDictArray = ref([]);
//获取全部字典表
function getAllDictArray() {
  allDictArray.value = [];//清空
  let array = dictInfoArray.value;
  for (let i = 0; i < array.length; i++) {
    let dictCode = array[i].dictCode;
    //字典表查询
    getValidDictItems(dictCode);
  }
}

//字典表查询
function getValidDictItems(dictCode) {
  //查询
  getValidDictItemsByDictCode(dictCode).then((response) => {
    nextTick(() => {
      let dictItems = response.data;
      let obj = {
        dictCode: dictCode,
        dictItems: dictItems
      };
      allDictArray.value.push(obj);
    });
  }).catch(err => {
  });
}

//获取字典数组
function getDictArray(data, col, colName, dataType) {
  let array = null;
  let dictCode = null;
  if (colName?.indexOf("液化程度") != -1 || colName?.indexOf("震陷程度") != -1) {
    dictCode = "smxyhcd";
  } else if (colName == "场地类别" || colName == "场地土分类" || colName == "场地类型") {
    dictCode = "smxcdlb";
  } else if (colName == "设防烈度" || colName == "抗震设防烈度" || colName == "评价单元设防烈度" || colName == "设防标准") {
    dictCode = "smxsfld";
  }
  if (dataType == "地下管网") {
    if (colName == "管材") {
      dictCode = "smxdxgwgc";
    } else if (colName == "接口形式") {
      dictCode = "smxdxgwjkxs";
    } else if (colName == "接口材料") {
      dictCode = "smxdxgwjkcl";
    }
  } else if (dataType == "供水-水厂泵房") {
    if (colName == "结构类型") {
      dictCode = "smxscbfjglx";
    }
  } else if (dataType == "供水-水厂水池") {
    if (colName == "结构形式") {
      dictCode = "smxscscjgxs";
    } else if (colName == "结构材料") {
      dictCode = "smxscscjgcl";
    } else if (colName == "池壁内侧竖向配筋表面形状" || colName == "池壁外侧竖向配筋表面形状") {
      dictCode = "smxscsccbsxpjbmxz";
    } else if (colName == "池壁内侧竖向钢筋等级" || colName == "池壁外侧竖向钢筋等级") {
      dictCode = "smxscsccbsxgjdj";
    } else if (colName == "水池形状") {
      dictCode = "smxscscscxz";
    }
  } else if (dataType == "燃气-储气罐") {

  } else if (dataType == "交通-桥梁") {
    if (colName == "跨越地物名称") {
      dictCode = "smxqlkydwmc";
    } else if (colName == "桥梁结构类型") {
      dictCode = "smxqljglx";
    } else if (colName == "桥梁等级") {
      dictCode = "smxqldj";
    } else if (colName == "地基失效程度") {
      dictCode = "smxqldjsxcd";
    } else if (colName == "上部结构") {
      dictCode = "smxqlsbjg";
    } else if (colName == "支座形式") {
      dictCode = "smxqlzzxs";
    } else if (colName == "基础型式") {
      dictCode = "smxqljcxs";
    } else if (colName == "桥墩材料" || colName == "桥台材料") {
      dictCode = "smxqlqdcl";
    } else if (colName == "桥台类型") {
      dictCode = "smxqlqtlx";
    }
  } else if (dataType == "交通-道路") {
    if (colName == "道路等级") {
      dictCode = "smxdldj";
    } else if (colName == "路基土") {
      dictCode = "smxdlljt";
    } else if (colName == "设防情况") {
      dictCode = "smxdlsfqk";
    } else if (colName == "地基失效") {
      dictCode = "smxdldjsx";
    } else if (colName == "路基类型") {
      dictCode = "smxdlljlx";
    } else if (colName == "路面类型") {
      dictCode = "smxdllmlx";
    }
  } else if (dataType == "电力-变电站") {
    if (colName == "主控室房屋结构类型") {
      dictCode = "smxbdzzkfwjglx";
    }
  } else if (dataType == "电力-架空线路") {
    if (colName == "杆塔类型") {
      dictCode = "smxbdztglx";
    } else if (colName == "地形地貌") {
      dictCode = "smxbdzdxdm";
    }
  } else if (dataType == "电力-电缆线路") {

  } else if (dataType == "电力-重要发电厂房") {
    if (colName == "发电类型") {
      dictCode = "smxfdcffdlx";
    }
  } else if (dataType == "通信-通信室内设备") {

  } else if (dataType == "通信-电视塔") {

  }

  if (dictCode) {
    //字典表
    let allArray = allDictArray.value;
    for (let i = 0; i < allArray.length; i++) {
      if (allArray[i].dictCode == dictCode) {
        array = [];
        let dictItems = allArray[i].dictItems;
        for (let i = 0; i < dictItems.length; i++) {
          let code = dictItems[i].dictItemCode;
          if (dataType == "通信-电视塔" && colName == "设防标准") {
            code = Number(code);
          }
          let obj = {
            code: code,
            name: dictItems[i].dictItemName,
          }
          array.push(obj);
        }
        break;
      }
    }
  } else {
    if (data.isEdit) {//编辑状态
      //省市县下拉选择
      if (colName == "省") {
        array = [];
        let provinceArray = provinceData.value;
        for (let i = 0; i < provinceArray.length; i++) {
          let obj = {
            code: provinceArray[i].name,
            name: provinceArray[i].name,
          }
          array.push(obj);
        }
      } else if (colName == "市") {
        array = [];
        let province = data["province"];
        //根据省获取市列表
        let cityArray = chooseProvince(province);
        for (let i = 0; i < cityArray.length; i++) {
          let obj = {
            code: cityArray[i].name,
            name: cityArray[i].name,
          }
          array.push(obj);
        }
      } else if (colName == "区县") {
        array = [];
        let province = data["province"];
        let city = data["city"];
        //根据省获取市列表
        let cityArray = chooseProvince(province);
        for (let i = 0; i < cityArray.length; i++) {
          if (cityArray[i].name == city) {
            //根据市获取区县列表
            let countyArray = chooseCity(cityArray[i].id);
            for (let i = 0; i < countyArray.length; i++) {
              let obj = {
                code: countyArray[i].name,
                name: countyArray[i].name,
              }
              array.push(obj);
            }
            break;
          }
        }
      }
    }
  }
  return array;
}

//查询结果多选事件
function handleSelectionChange(val) {
  multipleSelection.value = val;
}

//删除选择的数据
function deleteSelectData() {
  let ids = "";
  let selectRows = multipleSelection.value;
  if (selectRows != null && selectRows.length > 0) {
    if (selectRows.length > 10) {
      proxy.$modal.msgWarning("最多勾选10条数据进行删除!");
      return;
    }
    for (let i = 0; i < selectRows.length; i++) {
      if (ids != "") {
        ids += ",";
      }
      let uuid = getRowUuid(selectRows[i]);//根据数据类型获取主键id
      //主键
      if (uuid) {
        ids += uuid;
      }
    }
    //删除事件
    deleteEvent(ids, selectRows);
  } else {
    proxy.$modal.msgWarning("请勾选1条数据进行删除!");
  }
}

//根据数据类型获取主键id
function getRowUuid(row) {
  let selectType = props.selectType;
  let uuid = null;
  if (row) {
    if (selectType == '地下管网') {
      uuid = row.cdpnId;
    } else if (selectType == '供水-水厂泵房') {
      uuid = row.cwId;
    } else if (selectType == '供水-水厂水池') {
      uuid = row.cpId;
    } else if (selectType == '燃气-储气罐') {
      uuid = row.carId;
    } else if (selectType == '交通-桥梁') {
      uuid = row.cbId;
    } else if (selectType == '交通-道路') {
      uuid = row.crId;
    } else if (selectType == '电力-变电站') {
      uuid = row.ctsId;
    } else if (selectType == '电力-架空线路') {
      uuid = row.colId;
    } else if (selectType == '电力-电缆线路') {
      uuid = row.ccrId;
    } else if (selectType == '电力-重要发电厂房') {
      uuid = row.cipId;
    } else if (selectType == '通信-通信室内设备') {
      uuid = row.ccieId;
    } else if (selectType == '通信-电视塔') {
      uuid = row.cttId;
    }
  }

  return uuid;
}

//通用字段
const tableColumns0 = ref([
  { filedProp: "province", filedName: "省", filedType: "select" },
  { filedProp: "city", filedName: "市", filedType: "select" },
  { filedProp: "county", filedName: "区县", filedType: "select" },
  { filedProp: "extends1", filedName: "extends1", filedType: "input" },
  { filedProp: "extends2", filedName: "extends2", filedType: "input" },
  { filedProp: "extends3", filedName: "extends3", filedType: "input" },
  { filedProp: "extends4", filedName: "extends4", filedType: "input" },
  { filedProp: "extends5", filedName: "extends5", filedType: "input" },
  { filedProp: "extends6", filedName: "extends6", filedType: "input" },
  { filedProp: "extends7", filedName: "extends7", filedType: "input" },
  { filedProp: "extends8", filedName: "extends8", filedType: "input" },
  { filedProp: "extends9", filedName: "extends9", filedType: "input" },
  { filedProp: "extends10", filedName: "extends10", filedType: "input" },
  { filedProp: "createUser", filedName: "创建人", filedType: "input", readonly: "readonly" },
  { filedProp: "createTime", filedName: "创建时间", filedType: "input", readonly: "readonly" },
  { filedProp: "updateUser", filedName: "修改人", filedType: "input", readonly: "readonly" },
  { filedProp: "updateTime", filedName: "修改时间", filedType: "input", readonly: "readonly" },
]);

//地下管网
const tableColumns1 = ref([
  { filedProp: "id", filedName: "管道编码", filedType: "input" },
  { filedProp: "cdpnName", filedName: "管道名称", filedType: "input" },
  { filedProp: "cdpnClass", filedName: "管道类型", filedType: "input" },
  { filedProp: "startId", filedName: "起点编号", filedType: "int" },
  { filedProp: "endId", filedName: "终点编号", filedType: "int" },
  { filedProp: "longitude", filedName: "经度", filedType: "number", readonly: "readonly" },
  { filedProp: "latitude", filedName: "纬度", filedType: "number", readonly: "readonly" },
  { filedProp: "length", filedName: "管道长度", filedType: "number" },
  { filedProp: "material", filedName: "管材", filedType: "select" },
  { filedProp: "materialType", filedName: "管材型号", filedType: "input" },
  { filedProp: "elasticModulus", filedName: "弹性模量", filedType: "number" },
  { filedProp: "yieldLimitStress", filedName: "屈服极限应力", filedType: "number" },
  { filedProp: "strengthLimitStress", filedName: "强度极限应力", filedType: "number" },
  { filedProp: "permissibleStrain", filedName: "许用应变", filedType: "number" },
  { filedProp: "diameter", filedName: "管道直径", filedType: "number" },
  { filedProp: "thickness", filedName: "管道壁厚", filedType: "number" },
  { filedProp: "pressure", filedName: "工作压力", filedType: "number" },
  { filedProp: "joint", filedName: "接口形式", filedType: "select" },
  { filedProp: "jointy", filedName: "接口材料", filedType: "select" },
  { filedProp: "allowableElongation", filedName: "接口许用伸长", filedType: "input" },
  { filedProp: "site", filedName: "场地类别", filedType: "select" },
  { filedProp: "liquefaction6", filedName: "6度时液化程度", filedType: "select" },
  { filedProp: "liquefaction7", filedName: "7度时液化程度", filedType: "select" },
  { filedProp: "liquefaction8", filedName: "8度时液化程度", filedType: "select" },
  { filedProp: "liquefaction9", filedName: "9度时液化程度", filedType: "select" },
  { filedProp: "seismicSubsidence6", filedName: "6度时震陷程度", filedType: "select" },
  { filedProp: "seismicSubsidence7", filedName: "7度时震陷程度", filedType: "select" },
  { filedProp: "seismicSubsidence8", filedName: "8度时震陷程度", filedType: "select" },
  { filedProp: "seismicSubsidence9", filedName: "9度时震陷程度", filedType: "select" },
  { filedProp: "depth", filedName: "管道埋深", filedType: "number" },
  { filedProp: "year", filedName: "建设年代", filedType: "input", },
  { filedProp: "intensity", filedName: "设防烈度", filedType: "select" },
  { filedProp: "damageExtent", filedName: "破坏程度", filedType: "input", readonly: "readonly" },
  ...tableColumns0.value
]);

//供水-水厂泵房
const tableColumns2 = ref([
  { filedProp: "cwName", filedName: "水厂名称", filedType: "input" },
  { filedProp: "longitude", filedName: "经度", filedType: "number", readonly: "readonly" },
  { filedProp: "latitude", filedName: "纬度", filedType: "number", readonly: "readonly" },
  { filedProp: "id", filedName: "建筑物编码", filedType: "input" },
  { filedProp: "buildingName", filedName: "建筑物名称", filedType: "input" },
  { filedProp: "type", filedName: "结构类型", filedType: "select" },
  { filedProp: "floors", filedName: "建筑层数", filedType: "int" },
  { filedProp: "area", filedName: "建筑面积", filedType: "number" },
  { filedProp: "material", filedName: "混凝土等级", filedType: "input" },
  { filedProp: "materialType", filedName: "砖砌体标号", filedType: "input" },
  { filedProp: "site", filedName: "场地类别", filedType: "select" },
  { filedProp: "liquefaction6", filedName: "6度时液化程度", filedType: "select" },
  { filedProp: "liquefaction7", filedName: "7度时液化程度", filedType: "select" },
  { filedProp: "liquefaction8", filedName: "8度时液化程度", filedType: "select" },
  { filedProp: "liquefaction9", filedName: "9度时液化程度", filedType: "select" },
  { filedProp: "seismicSubsidence6", filedName: "6度时震陷程度", filedType: "select" },
  { filedProp: "seismicSubsidence7", filedName: "7度时震陷程度", filedType: "select" },
  { filedProp: "seismicSubsidence8", filedName: "8度时震陷程度", filedType: "select" },
  { filedProp: "seismicSubsidence9", filedName: "9度时震陷程度", filedType: "select" },
  { filedProp: "year", filedName: "建设年代", filedType: "input" },
  { filedProp: "intensity", filedName: "设防烈度", filedType: "select" },
  ...tableColumns0.value
]);

//供水-水厂水池
const tableColumns3 = ref([
  { filedProp: "id", filedName: "水池编码", filedType: "input" },
  { filedProp: "style", filedName: "结构形式", filedType: "select" },
  { filedProp: "material", filedName: "结构材料", filedType: "select" },
  { filedProp: "thickness", filedName: "水池壁厚", filedType: "number" },
  { filedProp: "shape", filedName: "水池形状", filedType: "select" },
  { filedProp: "radius", filedName: "水池半径", filedType: "number" },
  { filedProp: "slength", filedName: "水池短边", filedType: "number" },
  { filedProp: "length", filedName: "水池长边", filedType: "number" },
  { filedProp: "capacity", filedName: "容量", filedType: "number" },
  { filedProp: "depth", filedName: "水深度", filedType: "number" },
  { filedProp: "height", filedName: "水池高度", filedType: "number" },
  { filedProp: "joint", filedName: "矩形水池顶盖整体性是否良好，与池壁、立柱是否有可靠连接", filedType: "input" },
  { filedProp: "present", filedName: "使用现状", filedType: "input" },
  { filedProp: "quality", filedName: "施工质量", filedType: "input" },
  { filedProp: "surfaceShape1", filedName: "池壁内侧竖向配筋表面形状", filedType: "select" },
  { filedProp: "surfaceShape2", filedName: "池壁外侧竖向配筋表面形状", filedType: "select" },
  { filedProp: "diameter1", filedName: "池壁内侧竖向配筋直径", filedType: "number" },
  { filedProp: "diameter2", filedName: "池壁外侧竖向配筋直径", filedType: "number" },
  { filedProp: "strengthGrade", filedName: "混凝土强度等级", filedType: "input" },
  { filedProp: "kinds1", filedName: "池壁内侧竖向钢筋等级", filedType: "select" },
  { filedProp: "kinds2", filedName: "池壁外侧竖向钢筋等级", filedType: "select" },
  { filedProp: "thicknessLayer1", filedName: "池壁内侧最外层钢筋保护层厚度", filedType: "number" },
  { filedProp: "thicknessLayer2", filedName: "池壁外侧最外层钢筋保护层厚度", filedType: "number" },
  { filedProp: "innerReinforcement", filedName: "池壁内侧竖向配筋", filedType: "input" },
  { filedProp: "outReinforcement", filedName: "池壁外侧竖向配筋", filedType: "input" },
  { filedProp: "intensity", filedName: "设防烈度", filedType: "select" },
  { filedProp: "site", filedName: "场地类别", filedType: "select" },
  { filedProp: "year", filedName: "建设年代", filedType: "input" },
  { filedProp: "liquefaction6", filedName: "6度时液化程度", filedType: "select" },
  { filedProp: "liquefaction7", filedName: "7度时液化程度", filedType: "select" },
  { filedProp: "liquefaction8", filedName: "8度时液化程度", filedType: "select" },
  { filedProp: "liquefaction9", filedName: "9度时液化程度", filedType: "select" },
  { filedProp: "landform6", filedName: "6度时震陷程度", filedType: "select" },
  { filedProp: "landform7", filedName: "7度时震陷程度", filedType: "select" },
  { filedProp: "landform8", filedName: "8度时震陷程度", filedType: "select" },
  { filedProp: "landform9", filedName: "9度时震陷程度", filedType: "select" },
  ...tableColumns0.value
]);

//燃气-储气罐
const tableColumns4 = ref([
  { filedProp: "id", filedName: "储气罐编码", filedType: "input" },
  { filedProp: "carName", filedName: "储气罐名称", filedType: "input" },
  { filedProp: "longitude", filedName: "经度", filedType: "number", readonly: "readonly" },
  { filedProp: "latitude", filedName: "纬度", filedType: "number", readonly: "readonly" },
  { filedProp: "style", filedName: "型号", filedType: "input" },
  { filedProp: "capacity", filedName: "公称容积", filedType: "number" },
  { filedProp: "pressure", filedName: "工作压力", filedType: "number" },
  { filedProp: "innerDiameter", filedName: "筒体内径", filedType: "number" },
  { filedProp: "height", filedName: "筒体高度", filedType: "number" },
  { filedProp: "thickness", filedName: "筒体、封头壁厚", filedType: "number" },
  { filedProp: "weight", filedName: "参考重量", filedType: "number" },
  { filedProp: "material", filedName: "结构材料", filedType: "input" },
  { filedProp: "railLength", filedName: "导轨长度", filedType: "number" },
  { filedProp: "railHeight", filedName: "导轨高度", filedType: "number" },
  { filedProp: "railThickness", filedName: "导轨中腹厚度", filedType: "number" },
  { filedProp: "baseType", filedName: "基础形式", filedType: "input" },
  { filedProp: "materialType", filedName: "材料型号", filedType: "input" },
  { filedProp: "elasticModulus", filedName: "弹性模量", filedType: "number" },
  { filedProp: "yieldStress", filedName: "屈服应力", filedType: "number" },
  { filedProp: "permissibleStress", filedName: "许用应力", filedType: "number" },
  { filedProp: "site", filedName: "场地类别", filedType: "select" },
  { filedProp: "liquefaction6", filedName: "6度时液化程度", filedType: "select" },
  { filedProp: "liquefaction7", filedName: "7度时液化程度", filedType: "select" },
  { filedProp: "liquefaction8", filedName: "8度时液化程度", filedType: "select" },
  { filedProp: "liquefaction9", filedName: "9度时液化程度", filedType: "select" },
  { filedProp: "seismicSubsidence6", filedName: "6度时震陷程度", filedType: "select" },
  { filedProp: "seismicSubsidence7", filedName: "7度时震陷程度", filedType: "select" },
  { filedProp: "seismicSubsidence8", filedName: "8度时震陷程度", filedType: "select" },
  { filedProp: "seismicSubsidence9", filedName: "9度时震陷程度", filedType: "select" },
  { filedProp: "year", filedName: "建设年代", filedType: "input" },
  { filedProp: "intensity", filedName: "设防烈度", filedType: "select" },
  ...tableColumns0.value
]);

//交通-桥梁
const tableColumns5 = ref([
  { filedProp: "id", filedName: "编码", filedType: "input" },
  { filedProp: "cbName", filedName: "桥梁名称", filedType: "input" },
  { filedProp: "location", filedName: "所在位置", filedType: "input" },
  { filedProp: "acrossObject", filedName: "跨越地物名称", filedType: "select" },
  { filedProp: "intensity", filedName: "抗震设防烈度", filedType: "select" },
  { filedProp: "buildYear", filedName: "建造年代", filedType: "input" },
  { filedProp: "structure", filedName: "桥梁结构类型", filedType: "select" },
  { filedProp: "maxSpan", filedName: "最大跨径", filedType: "number" },
  { filedProp: "length", filedName: "跨径总长", filedType: "number" },
  { filedProp: "siteSoil", filedName: "场地土分类", filedType: "select" },
  { filedProp: "grade", filedName: "桥梁等级", filedType: "select" },
  { filedProp: "foundationFail", filedName: "地基失效程度", filedType: "select" },
  { filedProp: "superStructure", filedName: "上部结构", filedType: "select" },
  { filedProp: "bearing", filedName: "支座形式", filedType: "select" },
  { filedProp: "pierHeight", filedName: "桥墩高度", filedType: "number" },
  { filedProp: "pierMaterial", filedName: "桥墩材料", filedType: "select" },
  { filedProp: "basement", filedName: "基础型式", filedType: "select" },
  { filedProp: "capacity", filedName: "最大载重量", filedType: "number" },
  { filedProp: "abutmentMat", filedName: "桥台材料", filedType: "select" },
  { filedProp: "abutmentType", filedName: "桥台类型", filedType: "select" },
  { filedProp: "expansionJoint", filedName: "伸缩缝数量", filedType: "number" },
  { filedProp: "width", filedName: "桥梁宽度", filedType: "number" },
  { filedProp: "note", filedName: "简介", filedType: "input" },
  { filedProp: "damageExtent", filedName: "破坏程度", filedType: "input", readonly: "readonly" },
  ...tableColumns0.value
]);

//交通-道路
const tableColumns6 = ref([
  { filedProp: "id", filedName: "编码", filedType: "input" },
  { filedProp: "crName", filedName: "道路名称", filedType: "input" },
  { filedProp: "crClass", filedName: "道路等级", filedType: "select" },
  { filedProp: "cover", filedName: "区间", filedType: "input" },
  { filedProp: "roadbedSoil", filedName: "路基土", filedType: "select" },
  { filedProp: "siteSoil", filedName: "场地类别", filedType: "select" },
  { filedProp: "fortification", filedName: "设防情况", filedType: "select" },
  { filedProp: "foundationFail", filedName: "地基失效", filedType: "select" },
  { filedProp: "roadbedType", filedName: "路基类型", filedType: "select" },
  { filedProp: "roadbedHigh", filedName: "路基高差", filedType: "number" },
  { filedProp: "capacity", filedName: "最大载重量", filedType: "number" },
  { filedProp: "pavement", filedName: "路面类型", filedType: "select" },
  { filedProp: "length", filedName: "总里程", filedType: "number" },
  { filedProp: "width", filedName: "宽度", filedType: "number" },
  { filedProp: "note", filedName: "简介", filedType: "input" },
  { filedProp: "damageExtent", filedName: "破坏程度", filedType: "input", readonly: "readonly" },
  ...tableColumns0.value
]);

//电力-变电站
const tableColumns7 = ref([
  { filedProp: "id", filedName: "变电站编码", filedType: "input" },
  { filedProp: "ctsName", filedName: "变电站名称", filedType: "input" },
  { filedProp: "position", filedName: "变电站位置", filedType: "input" },
  { filedProp: "longitude", filedName: "经度", filedType: "number", readonly: "readonly" },
  { filedProp: "latitude", filedName: "纬度", filedType: "number", readonly: "readonly" },
  { filedProp: "typeSubstation", filedName: "变电站类型", filedType: "input" },
  { filedProp: "voltageGrade", filedName: "变电站电压等级", filedType: "int" },
  { filedProp: "structureType", filedName: "主控室房屋结构类型", filedType: "select" },
  { filedProp: "fortificationIntensity", filedName: "设防烈度", filedType: "select" },
  { filedProp: "substationTotalCost", filedName: "变电站总造价", filedType: "number" },
  { filedProp: "costHighVoltageOutdoor", filedName: "室外高压电气设备总造价", filedType: "number" },
  { filedProp: "costIndoorEquipment", filedName: "室内设备总造价", filedType: "number" },
  { filedProp: "costBuilding", filedName: "房屋建筑总造价", filedType: "number" },
  { filedProp: "year", filedName: "建设年代", filedType: "input" },
  { filedProp: "site", filedName: "场地类别", filedType: "select" },
  ...tableColumns0.value
]);

//电力-架空线路
const tableColumns8 = ref([
  //评价单元信息(精确到县区）
  {
    superColumnName: "评价单元信息(精确到县区）", filedArray: [
      { filedProp: "id", filedName: "评价单元编码", filedType: "input" },
      { filedProp: "colName", filedName: "评价单元名称", filedType: "input" },
      { filedProp: "fortificationIntensity", filedName: "评价单元设防烈度", filedType: "select" },
      // { filedProp:"lineType", filedName:"评价单元内线路类型", filedType:"input" },
    ]
  },
  //评价单元内35KV线路
  {
    superColumnName: "评价单元内35KV线路", filedArray: [
      { filedProp: "voltageGrade35", filedName: "线路电压等级", filedType: "number" },
      { filedProp: "lineLength35", filedName: "线路总长度", filedType: "number" },
      { filedProp: "loopLength35", filedName: "回路总长度", filedType: "number" },
      { filedProp: "landform35", filedName: "地形地貌", filedType: "select" },
      { filedProp: "unitCostLine35", filedName: "每公里线路总体造价", filedType: "number" },
      { filedProp: "type35", filedName: "杆塔类型", filedType: "select" },
      { filedProp: "number35", filedName: "杆塔数量", filedType: "number" },
      { filedProp: "unitCostTower35", filedName: "杆塔单价", filedType: "number" },
    ]
  },
  //评价单元内66KV线路
  {
    superColumnName: "评价单元内66KV线路", filedArray: [
      { filedProp: "voltageGrade66", filedName: "线路电压等级", filedType: "number" },
      { filedProp: "lineLength66", filedName: "线路总长度", filedType: "number" },
      { filedProp: "loopLength66", filedName: "回路总长度", filedType: "number" },
      { filedProp: "landform66", filedName: "地形地貌", filedType: "select" },
      { filedProp: "unitCostLine66", filedName: "每公里线路总体造价", filedType: "number" },
      { filedProp: "type66", filedName: "杆塔类型", filedType: "select" },
      { filedProp: "number66", filedName: "杆塔数量", filedType: "number" },
      { filedProp: "unitCostTower66", filedName: "杆塔单价", filedType: "number" },
    ]
  },
  //评价单元内110KV线路
  {
    superColumnName: "评价单元内110KV线路", filedArray: [
      { filedProp: "voltageGrade110", filedName: "线路电压等级", filedType: "number" },
      { filedProp: "lineLength110", filedName: "线路总长度", filedType: "number" },
      { filedProp: "loopLength110", filedName: "回路总长度", filedType: "number" },
      { filedProp: "landform110", filedName: "地形地貌", filedType: "select" },
      { filedProp: "unitCostLine110", filedName: "每公里线路总体造价", filedType: "number" },
      { filedProp: "type110", filedName: "杆塔类型", filedType: "select" },
      { filedProp: "number110", filedName: "杆塔数量", filedType: "number" },
      { filedProp: "unitCostTower110", filedName: "杆塔单价", filedType: "number" },
    ]
  },
  //评价单元内220KV线路
  {
    superColumnName: "评价单元内220KV线路", filedArray: [
      { filedProp: "voltageGrade220", filedName: "线路电压等级", filedType: "number" },
      { filedProp: "lineLength220", filedName: "线路总长度", filedType: "number" },
      { filedProp: "loopLength220", filedName: "回路总长度", filedType: "number" },
      { filedProp: "landform220", filedName: "地形地貌", filedType: "select" },
      { filedProp: "unitCostLine220", filedName: "每公里线路总体造价", filedType: "number" },
      { filedProp: "type220", filedName: "杆塔类型", filedType: "select" },
      { filedProp: "number220", filedName: "杆塔数量", filedType: "number" },
      { filedProp: "unitCostTower220", filedName: "杆塔单价", filedType: "number" },
    ]
  },
  //评价单元内330KV线路
  {
    superColumnName: "评价单元内330KV线路", filedArray: [
      { filedProp: "voltageGrade330", filedName: "线路电压等级", filedType: "number" },
      { filedProp: "lineLength330", filedName: "线路总长度", filedType: "number" },
      { filedProp: "loopLength330", filedName: "回路总长度", filedType: "number" },
      { filedProp: "landform330", filedName: "地形地貌", filedType: "select" },
      { filedProp: "unitCostLine330", filedName: "每公里线路总体造价", filedType: "number" },
      { filedProp: "type330", filedName: "杆塔类型", filedType: "select" },
      { filedProp: "number330", filedName: "杆塔数量", filedType: "number" },
      { filedProp: "unitCostTower330", filedName: "杆塔单价", filedType: "number" },
    ]
  },
  //评价单元内500KV线路
  {
    superColumnName: "评价单元内500KV线路", filedArray: [
      { filedProp: "voltageGrade500", filedName: "线路电压等级", filedType: "number" },
      { filedProp: "lineLength500", filedName: "线路总长度", filedType: "number" },
      { filedProp: "loopLength500", filedName: "回路总长度", filedType: "number" },
      { filedProp: "landform500", filedName: "地形地貌", filedType: "select" },
      { filedProp: "unitCostLine500", filedName: "每公里线路总体造价", filedType: "number" },
      { filedProp: "type500", filedName: "杆塔类型", filedType: "select" },
      { filedProp: "number500", filedName: "杆塔数量", filedType: "number" },
      { filedProp: "unitCostTower500", filedName: "杆塔单价", filedType: "number" },
    ]
  },
  //通用字段
  {
    superColumnName: "通用字段", filedArray: [
      ...tableColumns0.value
    ]
  },
]);

//电力-电缆线路
const tableColumns9 = ref([
  { filedProp: "id", filedName: "评价单元编码", filedType: "input" },
  { filedProp: "ccrName", filedName: "评价单元名称", filedType: "input" },
  { filedProp: "fortificationIntensity", filedName: "评价单元设防烈度", filedType: "select" },
  { filedProp: "lineLength", filedName: "线路总长度", filedType: "number" },
  { filedProp: "costLine", filedName: "所有电缆线路总体造价", filedType: "number" },
  ...tableColumns0.value
]);

//电力-重要发电厂房
const tableColumns10 = ref([
  { filedProp: "id", filedName: "电厂编码", filedType: "input" },
  { filedProp: "cipName", filedName: "电厂名称", filedType: "input" },
  { filedProp: "position", filedName: "位置", filedType: "input" },
  { filedProp: "longitude", filedName: "经度", filedType: "number", readonly: "readonly" },
  { filedProp: "latitude", filedName: "纬度", filedType: "number", readonly: "readonly" },
  { filedProp: "year", filedName: "建设年份", filedType: "input" },
  { filedProp: "fortificationIntensity", filedName: "设防烈度", filedType: "select" },
  { filedProp: "installedCapacity", filedName: "装机容量", filedType: "number" },
  { filedProp: "generatingType", filedName: "发电类型", filedType: "select" },
  { filedProp: "costPowerPlant", filedName: "发电厂总造价", filedType: "number" },
  { filedProp: "costSubstationEquipment", filedName: "变电设备造价", filedType: "number" },
  { filedProp: "costGeneratingEquipment", filedName: "发电设备总造价", filedType: "number" },
  { filedProp: "areaSteelStructures", filedName: "钢结构类建构筑物面积", filedType: "input" },
  { filedProp: "unitCostSteelStructure", filedName: "钢结构类建构筑物单价", filedType: "number" },
  { filedProp: "areaReinforcedConcrete", filedName: "钢筋混凝土类建构筑物面积", filedType: "input" },
  { filedProp: "unitCostReinforcedConcrete", filedName: "钢筋混凝土类建构筑物单价", filedType: "number" },
  { filedProp: "areaMasonryStructure", filedName: "砖混结构类建构筑物面积", filedType: "input" },
  { filedProp: "unitCostmasonryStructure", filedName: "砖混结构类建构筑物单价", filedType: "number" },
  ...tableColumns0.value
]);

//通信-通信室内设备
const tableColumns11 = ref([
  { filedProp: "inObjectName", filedName: "所属建筑物名称", filedType: "input" },
  { filedProp: "location", filedName: "所属建筑物地址位置", filedType: "input" },
  { filedProp: "objectLon", filedName: "所属建筑物地理经度坐标", filedType: "number", readonly: "readonly" },
  { filedProp: "objectLat", filedName: "所属建筑物地理纬度坐标", filedType: "number", readonly: "readonly" },
  { filedProp: "deviceType", filedName: "设备类别", filedType: "input" },
  { filedProp: "deviceName", filedName: "设备名称", filedType: "input" },
  { filedProp: "model", filedName: "型号", filedType: "input" },
  { filedProp: "inFloor", filedName: "所在楼层", filedType: "int" },
  { filedProp: "fixedForm", filedName: "设备固定形式", filedType: "input" },
  { filedProp: "boltDiameter", filedName: "底部螺栓直径", filedType: "number" },
  { filedProp: "purchaseCost", filedName: "重新购置的造价", filedType: "number" },
  { filedProp: "manufacturers", filedName: "厂家", filedType: "input" },
  { filedProp: "size", filedName: "尺寸", filedType: "input" },
  { filedProp: "weight", filedName: "重量", filedType: "number" },
  ...tableColumns0.value
]);

//通信-电视塔
const tableColumns12 = ref([
  { filedProp: "objectName", filedName: "电视塔名称", filedType: "input" },
  { filedProp: "location", filedName: "地址位置", filedType: "input" },
  { filedProp: "objectLon", filedName: "地理经度坐标", filedType: "number", readonly: "readonly" },
  { filedProp: "objectLat", filedName: "地理纬度坐标", filedType: "number", readonly: "readonly" },
  { filedProp: "cttType", filedName: "结构类型", filedType: "input" },
  { filedProp: "area", filedName: "建筑面积", filedType: "number" },
  { filedProp: "year", filedName: "建造年代", filedType: "input" },
  { filedProp: "height", filedName: "总高度", filedType: "number" },
  { filedProp: "towerElevation", filedName: "塔楼处标高", filedType: "number" },
  { filedProp: "buldingSite", filedName: "建筑物场址", filedType: "input" },
  { filedProp: "designIntensity", filedName: "设防标准", filedType: "select" },
  { filedProp: "fieldType", filedName: "场地类型", filedType: "select" },
  { filedProp: "status", filedName: "现状评价", filedType: "input" },
  { filedProp: "reconstructionCost", filedName: "重建单位面积造价", filedType: "number" },
  { filedProp: "antennaElevation", filedName: "天线处标高", filedType: "number" },
  { filedProp: "period", filedName: "基本周期", filedType: "number" },
  { filedProp: "colmnType", filedName: "塔柱结构类型", filedType: "input" },
  { filedProp: "baseType", filedName: "塔座结构类型", filedType: "input" },
  { filedProp: "baseStoryNum", filedName: "塔座层数", filedType: "int" },
  { filedProp: "baseHeight", filedName: "塔座高度", filedType: "number" },
  ...tableColumns0.value
]);

//全部表格字段信息数组
const allTableColumns = ref([
  tableColumns1.value, tableColumns2.value, tableColumns3.value, tableColumns4.value, tableColumns5.value,
  tableColumns6.value, tableColumns7.value, tableColumns8.value, tableColumns9.value, tableColumns10.value,
  tableColumns11.value, tableColumns12.value,
]);

//删除事件
function deleteEvent(ids, rows) {
  if (ids && ids !== "") {
    let type = (dataTypeArray.value.indexOf(props.selectType) + 1).toString();//数据类型
    if (type == "5") {//桥梁类型
      let flag = rows[0].flag;
      if (flag == null) {
        return;
      }
      let idArr = ids.split(",");
      let idsFlag0 = "";
      let idsFlag1 = "";
      for (let i = 0; i < rows.length; i++) {
        if (rows[i].flag === "0") {
          if (idsFlag0 != "") {
            idsFlag0 += ",";
          }
          idsFlag0 += idArr[i];
        } else if (rows[i].flag === "1") {
          if (idsFlag1 != "") {
            idsFlag1 += ",";
          }
          idsFlag1 += idArr[i];
        }
      }
      proxy.$modal
        .confirm("请确认是否要删除？",)
        .then(function () {
          if (idsFlag0 != "") {
            let formMap = new Map();
            formMap.set("ids", idsFlag0);
            formMap.set("flag", "0");
            //map转obj
            let obj = Object.create(null);
            for (let [k, v] of formMap) {
              obj[k] = v;
            }
            let data = {
              map: obj,
              type: type
            }
            //桥梁--删除数据
            return bridgeDeleteData(data);
          }
          return true;
        })
        .then(() => {
          if (idsFlag1 != "") {
            let formMap = new Map();
            formMap.set("ids", idsFlag1);
            formMap.set("flag", "1");
            //map转obj
            let obj = Object.create(null);
            for (let [k, v] of formMap) {
              obj[k] = v;
            }
            let data = {
              map: obj,
              type: type
            }
            //桥梁--删除数据
            return bridgeDeleteData(data);
          }
          return true;
        })
        .then(() => {
          //查询数据
          queryTableData();
          proxy.$modal.msgSuccess("删除成功");
        })
        .catch(() => { });
    } else {
      proxy.$modal
        .confirm("请确认是否要删除？",)
        .then(function () {
          let formMap = new Map();
          formMap.set("ids", ids);
          //map转obj
          let obj = Object.create(null);
          for (let [k, v] of formMap) {
            obj[k] = v;
          }
          let data = {
            map: obj,
            type: type
          }
          //删除数据
          return deleteData(data);
        })
        .then(() => {
          //查询数据
          queryTableData();
          proxy.$modal.msgSuccess("删除成功");
        })
        .catch(() => { });
    }
  }
}

//删除
const handleDelete = (index, row) => {
  let uuid = getRowUuid(row);//根据数据类型获取主键id
  let rows = [row];
  //删除事件
  deleteEvent(uuid, rows);
}

//修改
const handleModify = (index, row) => {
  if (row.isEdit) {//保存修改
    let type = (dataTypeArray.value.indexOf(props.selectType) + 1).toString();//数据类型
    let formMap = new Map();
    formMap.set(type, row);
    //map转obj
    let obj = Object.create(null);
    for (let [k, v] of formMap) {
      obj[k] = v;
    }
    let form = {
      map: obj,
      type: type
    }
    //校验
    proxy.$refs['formTable'].validate((valid, fields) => {
      if (valid) {
        //更新数据
        updateData(form).then((res) => {
          if (res.code === 200) {
            ElMessage({
              type: 'success',
              message: '修改成功!'
            });
            row.isEdit = false;
            //查询数据
            queryTableData();
          }
        }).catch(err => {
        });
      } else {
        proxy.$modal.msgWarning("校验失败!");
        proxy.$refs['formTable'].scrollToField(Object.keys(fields)[0]);
      }
    });
  } else {//开启修改
    row.isEdit = true;
  }
}

//下拉框选择事件
const onChangeSelect = (value, filedProp, row) => {
  //省市县下拉选择事件
  if (filedProp == "province") {
    row["city"] = "";
    row["county"] = "";
  } else if (filedProp == "city") {
    row["county"] = "";
  } else if (filedProp == "county") {

  }
}

/** 获取省列表 */
function getProvinceData() {
  provinceData.value = [];
  allCityData.value = new Map();
  allCountyData.value = new Map();
  //全部省
  getProvince().then((response) => {
    let provinceArray = response.data;
    provinceData.value = provinceArray;
    for (let i = 0; i < provinceArray.length; i++) {
      //获取市列表
      getCityData(provinceArray[i].id);
    }
  });
}

//获取市列表
function getCityData(provinceId) {
  getChildArea(provinceId).then(response => {
    let cityArray = response.data;
    allCityData.value.set(provinceId, cityArray);
    for (let i = 0; i < cityArray.length; i++) {
      //获取区县列表
      getCountyData(cityArray[i].id);
    }
  });
}

//获取区县列表
function getCountyData(cityId) {
  getChildArea(cityId).then(response => {
    let countyData = response.data;
    allCountyData.value.set(cityId, countyData);
  });
}

//根据省名获取省ID
function getProvinceId(name) {
  let provinceId = null;
  let provinceArray = provinceData.value;
  for (let i = 0; i < provinceArray.length; i++) {
    if (provinceArray[i].name == name) {
      provinceId = provinceArray[i].id;
      break;
    }
  }
  return provinceId;
}

//根据省获取市列表
const chooseProvince = (name) => {
  let cityData = [];
  let provinceId = getProvinceId(name);//根据省名获取省ID
  if (provinceId) {
    cityData = allCityData.value.get(provinceId);
  }
  return cityData;
}
//根据市获取区县列表
const chooseCity = (cityId) => {
  let areaData = [];
  if (cityId) {
    areaData = allCountyData.value.get(cityId);
  }
  return areaData;
}

//当前登录人ID
function getCurrentUserId() {
  let userId = getUserId();
  currentUserId.value = userId;
}

const userInfoMap = ref(new Map());//用户信息Map
// 获取用户名
function getUserInfo(index, data, col) {
  let userName = "";
  let userId = data[col];
  if (userId) {
    userName = userInfoMap.value.get(userId);
    if (userName == undefined) {
      userName = "";
      //用户信息Map
      userInfoMap.value.set(userId, userName);
      //获取用户信息
      getInfo(userId).then(response => {
        userName = response.user.userName;
        //用户信息Map
        userInfoMap.value.set(userId, userName);
        //遍历更新用户数据
        let tableData = tableDataForm.value.tableData;
        for (let i = 0; i < tableData.length; i++) {
          if (tableData[i].createUser == userId) {
            //设置用户名
            tableDataForm.value.tableData[i].dictItemNameObj["createUser"] = userName;
          }
          if (tableData[i].updateUser == userId) {
            //设置用户名
            tableDataForm.value.tableData[i].dictItemNameObj["updateUser"] = userName;
          }
        }
      });
    }
  }

  return userName;
}

//获取省列表
getProvinceData();
//当前登录人ID
getCurrentUserId();
//获取全部字典表
getAllDictArray();

</script>

<style lang="scss" scoped>
.min-Table {
  height: 250px;
}

.max-Table {
  height: 90%;
}

//下方查看详情面板
.new-queryResultDiv {
  position: absolute;
  left: 0px;
  right: 0px;
  bottom: 0px;
  background: #fff;
  z-index: 10;
  border: 1px solid #e4e7ed;
}

.new-queryTableBtn {
  position: absolute;
  left: 0px;
  right: 0px;
  top: 0px;
  height: 50px;
  padding: 10px;
}

.new-queryTableSpan {
  position: relative;
  top: -32px;
  width: 100%;
  text-align: center;
  font-weight: bold;
  font-size: 18px;
  color: #107ce5;
  display: inline-block;
  line-height: 32px;
  z-index: -1;
}

.new-queryTableDiv {
  position: absolute;
  left: 0px;
  right: 0px;
  top: 50px;
  bottom: 50px;
}

.new-queryTableDiv-page {
  position: absolute;
  left: 0px;
  right: 0px;
  bottom: 0px;
  height: 50px;
  padding: 8px;
}

:deep(.el-form-item--default) {
  padding-top: 20px;
}

/*多级表头的边框*/
:deep(.el-table thead.is-group th.el-table__cell) {
  border-bottom: 1px solid #CCCCCC;
  border-right: 1px solid #CCCCCC;
}
</style>